Skip to content

Commit

Permalink
chore: update ESLint and all its plugins, increase lint coverage (#2616)
Browse files Browse the repository at this point in the history
- Updated ESLint from 6.8.0 to 8.56.0
- Updated all ESLint plugins
- Swapped babel-eslint for @typescript-eslint/parser (adds ability to e.g. use import assertions, necessary to lint Rollup config files, and potentially more in the future)
- Revised the list of rules (many were turned on by plugin updates) to avoid breakages; list to be revised later, we may decide to gracefully turn on the new rules and fix the issues.
  • Loading branch information
wojtekmaj committed Feb 7, 2024
1 parent c18736b commit 4c68b3b
Show file tree
Hide file tree
Showing 5 changed files with 1,021 additions and 837 deletions.
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.gitignore
node_modules
lib
dist
rollup.config.js
packages/pdfkit
37 changes: 21 additions & 16 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"parser": "babel-eslint",
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"env": {
"browser": true,
"es6": true,
Expand All @@ -17,29 +21,29 @@
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["react"],
"rules": {
"arrow-body-style": 0,
"default-case-last": 0,
"default-param-last": 0,
"func-names": 0,
"no-continue": 1,
"import/no-named-as-default": 0,
"import/no-unresolved": ["error", { "ignore": ["^yoga-layout"] }],
"no-cond-assign": 1,
"react/prop-types": 0,
"prefer-destructuring": 1,
"no-use-before-define": 1,
"no-continue": 1,
"no-promise-executor-return": 0,
"no-underscore-dangle": 0,
"no-use-before-define": 1,
"prefer-destructuring": 1,
"prefer-exponentiation-operator": 1,
"prefer-object-spread": 0,
"import/no-named-as-default": 0,
"react/state-in-constructor": 0,
"react/destructuring-assignment": 0,
"react/function-component-definition": 0,
"react/jsx-filename-extension": 0,
"react/jsx-props-no-spreading": 0,
"react/destructuring-assignment": 0,
"import/no-unresolved": ["error", { "ignore": ["^yoga-layout"] }]
"react/jsx-no-useless-fragment": 0,
"react/prop-types": 0,
"react/state-in-constructor": 0
},
"overrides": [
{
Expand All @@ -48,6 +52,7 @@
"**/*.test.jsx",
"**/tests/**/*.js",
"**/tests/**/*.jsx",
"rollup.config.js",
"vitest.config.js",
"vitest.*.config.js",
"vitest.setup.js"
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@
"@rollup/plugin-replace": "^5.0.0",
"@rollup/plugin-terser": "^0.4.4",
"@testing-library/react": "^14.0.0",
"@typescript-eslint/parser": "^6.21.0",
"@vitejs/plugin-react": "^4.2.1",
"babel-eslint": "^10.0.1",
"babel-plugin-add-module-exports": "^1.0.0",
"canvas": "^2.11.2",
"chalk": "^2.4.2",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-config-prettier": "^4.0.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^2.5.1",
"eslint": "^8.56.0",
"eslint-config-airbnb": "^19.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-promise": "^6.1.0",
"eslint-plugin-react": "^7.33.0",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^9.0.0",
"jest-image-snapshot": "^6.1.0",
"jsdom": "^23.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/png-js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class PNG {
if (BROWSER) {
throw new Error('PNG.decode not available in browser build');
} else {
return fs.readFile(path, function (err, file) {
return fs.readFile(path, (err, file) => {
const png = new PNG(file);
return png.decode((pixels) => fn(pixels));
});
Expand Down

0 comments on commit 4c68b3b

Please sign in to comment.