Skip to content

Commit

Permalink
Updated to the latest dependencies, migrated to eslint and playwright (
Browse files Browse the repository at this point in the history
…microsoft#101)

* Updated to the latest dependencies, migrated to eslint and playwright

* Updated changelog

* Updated node-version

* Fixed eslint problem

* added eslint in package.json

* added eslint/parser
  • Loading branch information
AleksSavelev authored Jan 6, 2023
1 parent 8ee15ee commit 5a90c3e
Show file tree
Hide file tree
Showing 34 changed files with 10,537 additions and 7,433 deletions.
14 changes: 14 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.github
.tmp
coverage
lib
node_modules
dist
.eslintrc.js
karma.conf.ts
webpack.config.js
globalize
test
dateFormatter.ts
numberFormatter.ts
localStorageService.ts
20 changes: 20 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
env: {
"browser": true,
"es6": true,
"es2017": true
},
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.json",
tsconfigRootDir: ".",
},
plugins: [
"powerbi-visuals"
],
extends: [
"plugin:powerbi-visuals/recommended"
],
rules: {}
};
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
node-version: [12.x]
node-version: [14.x]

steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
/coverage
/lib
*.map
/.tmp
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 5.0.0
* Packages update
* Vulnerabilities fixes
* Migrated to playwright
* Migrated to Webpack 5

## 4.7.1
* Packages update
* Vulnerabilities fixes
Expand Down
1 change: 0 additions & 1 deletion globalize/globalize.cultures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* This file was generated by the Globalize Culture Generator
* Translation: bugs found in this file need to be fixed in the generator
*/
/* tslint:disable */
export default function injectCultures(Globalize) {

Globalize.addCultureInfo("ar", "default", {
Expand Down
31 changes: 15 additions & 16 deletions globalize/globalize.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* tslint:disable */
export interface GlobalizeCulture {
name: string;
calendar: GlobalizeCalendar;
Expand Down Expand Up @@ -306,7 +305,7 @@ arrayIndexOf = function (array, item) {
};

endsWith = function (value, pattern) {
return value.substr(value.length - pattern.length) === pattern;
return value.substring(value.length - pattern.length) === pattern;
};

extend = function (deep) {
Expand Down Expand Up @@ -495,7 +494,7 @@ formatDate = function (value, format, culture) {
var r, s = num + "";
if (c > 1 && s.length < c) {
r = (zeros[c - 2] + s);
return r.substr(r.length - c, c);
return r.substring(r.length - c, r.length);
}
else {
r = s;
Expand Down Expand Up @@ -650,7 +649,7 @@ formatDate = function (value, format, culture) {
case "fff":
// Milliseconds
ret.push(
padZeros(value.getMilliseconds(), 3).substr(0, clength)
padZeros(value.getMilliseconds(), 3).substring(0, clength)
);
break;
case "z":
Expand Down Expand Up @@ -719,7 +718,7 @@ formatDate = function (value, format, culture) {
if (exponent > 0) {
right = zeroPad(right, exponent, false);
numberString += right.slice(0, exponent);
right = right.substr(exponent);
right = right.substring(exponent);
}
else if (exponent < 0) {
exponent = -exponent;
Expand Down Expand Up @@ -1230,10 +1229,10 @@ parseNegativePattern = function (value, nf, negativePattern) {
// fall through
case "n-":
if (endsWith(value, neg)) {
ret = ["-", value.substr(0, value.length - neg.length)];
ret = ["-", value.substring(0, value.length - neg.length)];
}
else if (endsWith(value, pos)) {
ret = ["+", value.substr(0, value.length - pos.length)];
ret = ["+", value.substring(0, value.length - pos.length)];
}
break;
case "- n":
Expand All @@ -1242,15 +1241,15 @@ parseNegativePattern = function (value, nf, negativePattern) {
// fall through
case "-n":
if (startsWith(value, neg)) {
ret = ["-", value.substr(neg.length)];
ret = ["-", value.substring(neg.length)];
}
else if (startsWith(value, pos)) {
ret = ["+", value.substr(pos.length)];
ret = ["+", value.substring(pos.length)];
}
break;
case "(n)":
if (startsWith(value, "(") && endsWith(value, ")")) {
ret = ["-", value.substr(1, value.length - 2)];
ret = ["-", value.substring(1, value.length - 1)];
}
break;
}
Expand Down Expand Up @@ -1348,7 +1347,7 @@ Globalize.findClosestCulture = function (name) {
else {
name = trim(parts[1]);
if (name.indexOf("q=") === 0) {
name = name.substr(2);
name = name.substring(2);
pri = parseFloat(name);
pri = isNaN(pri) ? 0 : pri;
}
Expand Down Expand Up @@ -1380,7 +1379,7 @@ Globalize.findClosestCulture = function (name) {
break;
}
// strip off the last part. e.g. en-US => en
lang = lang.substr(0, index);
lang = lang.substring(0, index);
match = cultures[lang];
if (match) {
return match;
Expand Down Expand Up @@ -1510,8 +1509,8 @@ Globalize.parseFloat = function (value, radix, cultureSelector) {
exponent = null;
}
else {
intAndFraction = num.substr(0, exponentPos);
exponent = num.substr(exponentPos + 1);
intAndFraction = num.substring(0, exponentPos);
exponent = num.substring(exponentPos + 1);
}
// determine decimal position
var integer,
Expand All @@ -1523,8 +1522,8 @@ Globalize.parseFloat = function (value, radix, cultureSelector) {
fraction = null;
}
else {
integer = intAndFraction.substr(0, decimalPos);
fraction = intAndFraction.substr(decimalPos + decSep.length);
integer = intAndFraction.substring(0, decimalPos);
fraction = intAndFraction.substring(decimalPos + decSep.length);
}
// handle groups (e.g. 1,000,000)
var groupSep = nf[","];
Expand Down
11 changes: 3 additions & 8 deletions karma.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,15 @@
const webpackConfig = require("./webpack.config.js");
const tsconfig = require("./tsconfig.json");

import { Config, ConfigOptions } from "karma";

const testRecursivePath = "test/**/*.ts";
const srcOriginalRecursivePath = "src/**/*.ts";
const srcRecursivePath = "lib/**/*.js";
const srcCssRecursivePath = "lib/**/*.css";
const coverageFolder = "coverage";

process.env.CHROME_BIN = require("puppeteer").executablePath();
module.exports = (config: Config) => {
config.set(<ConfigOptions>{
process.env.CHROME_BIN = require("playwright-chromium").chromium.executablePath();
module.exports = (config) => {
config.set({
browsers: ["ChromeHeadless"],
colors: true,
frameworks: ["jasmine"],
Expand All @@ -54,7 +52,6 @@ module.exports = (config: Config) => {
},
singleRun: true,
plugins: [
"karma-remap-istanbul",
"karma-coverage",
"karma-typescript",
"karma-webpack",
Expand All @@ -64,8 +61,6 @@ module.exports = (config: Config) => {
"karma-coverage-istanbul-reporter"
],
files: [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/jasmine-jquery/lib/jasmine-jquery.js",
srcCssRecursivePath,
srcRecursivePath,
testRecursivePath,
Expand Down
Loading

0 comments on commit 5a90c3e

Please sign in to comment.