From e60762af9fb15f2ea19b3a499696e8fd19cc8260 Mon Sep 17 00:00:00 2001 From: Philipp Kewisch Date: Wed, 10 Apr 2024 13:17:15 +0200 Subject: [PATCH] Remove deprecated and double eslint rules --- eslint.config.js | 202 ++++++++++------------------------------------ package-lock.json | 80 ++++++++++++++++++ package.json | 1 + 3 files changed, 123 insertions(+), 160 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index ea4f30d5..16141b00 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -23,118 +23,70 @@ export default [ rules: { // Enforce one true brace style (opening brace on the same line) // Allow single line (for now) because of the vast number of changes needed - "brace-style": ["error", "1tbs", { allowSingleLine: true }], + "@stylistic/brace-style": ["error", "1tbs", { allowSingleLine: true }], // Enforce newline at the end of file, with no multiple empty lines. - "eol-last": "error", + "@stylistic/eol-last": "error", // Disallow using variables outside the blocks they are defined //"block-scoped-var": "error", // Allow trailing commas for easy list extension. Having them does not // impair readability, but also not required either. - "comma-dangle": 0, + "@stylistic/comma-dangle": 0, // Enforce spacing before and after comma - "comma-spacing": ["error", { before: false, after: true }], + "@stylistic/comma-spacing": ["error", { before: false, after: true }], // Enforce one true comma style. - "comma-style": ["error", "last"], + "@stylistic/comma-style": ["error", "last"], // Enforce curly brace conventions for all control statements. //"curly": "error", // Enforce the spacing around the * in generator functions. - "generator-star-spacing": ["error", "after"], + "@stylistic/generator-star-spacing": ["error", "after"], // Require space before/after arrow function's arrow - "arrow-spacing": ["error", { before: true, after: true }], + "@stylistic/arrow-spacing": ["error", { before: true, after: true }], // Enforces spacing between keys and values in object literal properties. - "key-spacing": ["error", { beforeColon: false, afterColon: true, mode: "minimum" }], + "@stylistic/key-spacing": ["error", { beforeColon: false, afterColon: true, mode: "minimum" }], // Disallow the omission of parentheses when invoking a constructor with no // arguments. - "new-parens": "error", + "@stylistic/new-parens": "error", // Disallow use of the Array constructor. "no-array-constructor": "error", // disallow use of the Object constructor - "no-new-object": "error", + "@stylistic/no-new-object": "error", // Disallow Primitive Wrapper Instances "no-new-wrappers": "error", // Disallow the catch clause parameter name being the same as a variable in // the outer scope, to avoid confusion. - "no-catch-shadow": "error", - - // Disallow assignment in conditional expressions. - "no-cond-assign": "error", - - // Disallow use of debugger. - "no-debugger": "error", - - // Disallow deletion of variables (deleting properties is fine). - "no-delete-var": "error", - - // Disallow duplicate arguments in functions. - "no-dupe-args": "error", - - // Disallow duplicate keys when creating object literals. - "no-dupe-keys": "error", - - // Disallow a duplicate case label. - "no-duplicate-case": "error", - - // Disallow the use of empty character classes in regular expressions. - "no-empty-character-class": "error", - - // Disallow assigning to the exception in a catch block. - "no-ex-assign": "error", + "@stylistic/no-catch-shadow": "error", // Disallow adding to native types "no-extend-native": "error", - // Disallow double-negation boolean casts in a boolean context. - "no-extra-boolean-cast": "error", - // Disallow unnecessary semicolons. - "no-extra-semi": "error", + "@stylistic/no-extra-semi": "error", // Disallow mixed spaces and tabs for indentation. - "no-mixed-spaces-and-tabs": "error", + "@stylistic/no-mixed-spaces-and-tabs": "error", // Disallow reassignments of native objects. - "no-native-reassign": "error", - - // Disallow use of octal literals. - "no-octal": "error", + "@stylistic/no-native-reassign": "error", // Disallow comparisons where both sides are exactly the same. "no-self-compare": "error", - // Disallow sparse arrays, eg. let arr = [,,2]. - // Array destructuring is fine though: - // for (let [, breakpointPromise] of aPromises) - "no-sparse-arrays": "error", - // Disallow trailing whitespace at the end of lines. - "no-trailing-spaces": "error", - - // Disallow use of the with statement. - "no-with": "error", - - // Disallow comparisons with the value NaN. - "use-isnan": "error", - - // Ensure that the results of typeof are compared against a valid string. - "valid-typeof": "error", - - // disallow the use of object properties of the global object (Math and - // JSON) as functions - "no-obj-calls": "error", + "@stylistic/no-trailing-spaces": "error", // disallow use of octal escape sequences in string literals, such as // var foo = "Copyright \251"; @@ -157,7 +109,7 @@ export default [ //"space-unary-ops": ["error", { "words": true, "nonwords": false }], // Enforce spacing after semicolons. - "semi-spacing": ["error", { before: false, after: true }], + "@stylistic/semi-spacing": ["error", { before: false, after: true }], // Disallow the use of Boolean literals in conditional expressions. "no-unneeded-ternary": "error", @@ -165,20 +117,17 @@ export default [ // Disallow use of multiple spaces (sometimes used to align const values, // array or object items, etc.). It's hard to maintain and doesn't add that // much benefit. - "no-multi-spaces": "error", + "@stylistic/no-multi-spaces": "error", // Require spaces around operators, except for a|0. // Disabled for now given eslint doesn't support default args yet // "space-infix-ops": ["error", {"int32Hint": true}], // Require a space around all keywords. - "keyword-spacing": "error", + "@stylistic/keyword-spacing": "error", // Disallow space between function identifier and application. - "no-spaced-func": "error", - - // Disallow shadowing of names such as arguments. - "no-shadow-restricted-names": "error", + "@stylistic/no-spaced-func": "error", // Disallow use of comma operator. "no-sequences": "error", @@ -194,28 +143,14 @@ export default [ //"padded-blocks": ["error", "never"], // Disallow spaces inside parentheses. - "space-in-parens": ["error", "never"], + "@stylistic/space-in-parens": ["error", "never"], // Require space after keyword for anonymous functions, but disallow space // after name of named functions. - "space-before-function-paren": ["error", { anonymous: "never", named: "never" }], - - // Disallow unreachable statements after a return, throw, continue, or break - // statement. - "no-unreachable": "error", + "@stylistic/space-before-function-paren": ["error", { anonymous: "never", named: "never" }], // Always require use of semicolons wherever they are valid. - "semi": ["error", "always"], - - // Disallow empty statements. This will report an error for: - // try { something(); } catch (e) {} - // but will not report it for: - // try { something(); } catch (e) { /* Silencing the error because ...*/ } - // which is a valid use case. - "no-empty": "error", - - // Disallow declaring the same variable more than once (we use let anyway). - "no-redeclare": "error", + "@stylistic/semi": ["error", "always"], // Warn about declaration of variables already declared in the outer scope. "no-shadow": "error", @@ -224,25 +159,13 @@ export default [ "no-unused-vars": ["error", { vars: "all", args: "none" }], // Require padding inside curly braces - "object-curly-spacing": ["error", "always"], + "@stylistic/object-curly-spacing": ["error", "always"], // Disallow spaces inside of brackets - "array-bracket-spacing": ["error", "never"], - - // Disallow control characters in regular expressions - "no-control-regex": "error", - - // Disallow invalid regular expression strings in RegExp constructors - "no-invalid-regexp": "error", - - // Disallow multiple spaces in regular expression literals - "no-regex-spaces": "error", - - // Disallow irregular whitespace - "no-irregular-whitespace": "error", + "@stylistic/array-bracket-spacing": ["error", "never"], // Disallow negating the left operand in `in` expressions - "no-negated-in-lhs": "error", + "@stylistic/no-negated-in-lhs": "error", // Disallow constant expressions in conditions //"no-constant-condition": ["error", {"checkLoops": false }], @@ -254,32 +177,14 @@ export default [ "no-iterator": "error", // Enforce consistent linebreak style - "linebreak-style": ["error", "unix"], + "@stylistic/linebreak-style": ["error", "unix"], // Enforces return statements in callbacks of array's methods "array-callback-return": "error", - // Verify super() calls in constructors - "constructor-super": "error", - - // Disallow modifying variables of class declarations - "no-class-assign": "error", - - // Disallow modifying variables that are declared using const - "no-const-assign": "error", - - // Disallow duplicate name in class members - "no-dupe-class-members": "error", - - // Disallow use of this/super before calling super() in constructors - "no-this-before-super": "error", - // Disallow duplicate imports "no-duplicate-imports": "error", - // Disallow empty destructuring patterns - "no-empty-pattern": "error", - // Disallow Labeled Statements "no-labels": "error", @@ -287,17 +192,11 @@ export default [ "no-multi-str": "error", // Disallow Symbol Constructor - "no-new-symbol": "error", + "@stylistic/no-new-symbol": "error", // Disallow Initializing to undefined "no-undef-init": "error", - // Disallow control flow statements in finally blocks - "no-unsafe-finally": "error", - - // Disallow Unused Labels - "no-unused-labels": "error", - // Disallow unnecessary computed property keys on objects "no-useless-computed-key": "error", @@ -309,16 +208,16 @@ export default [ "no-useless-rename": "error", // Enforce spacing between rest and spread operators and their expressions - "rest-spread-spacing": ["error", "never"], + "@stylistic/rest-spread-spacing": ["error", "never"], // Disallow usage of spacing in template string expressions - "template-curly-spacing": ["error", "never"], + "@stylistic/template-curly-spacing": ["error", "never"], // Disallow the Unicode Byte Order Mark "unicode-bom": ["error", "never"], // Enforce spacing around the * in yield* expressions - "yield-star-spacing": ["error", "after"], + "@stylistic/yield-star-spacing": ["error", "after"], // Disallow Implied eval "no-implied-eval": "error", @@ -329,12 +228,6 @@ export default [ // Disallow new For Side Effects "no-new": "error", - // Disallow Self Assignment - "no-self-assign": "error", - - // Disallow confusing multiline expressions - "no-unexpected-multiline": "error", - // Require IIFEs to be Wrapped //"wrap-iife": ["error", "inside"], @@ -345,22 +238,19 @@ export default [ "no-inner-declarations": "error", // Enforce newline before and after dot - "dot-location": ["error", "property"], + "@stylistic/dot-location": ["error", "property"], // Disallow Use of caller/callee "no-caller": "error", - // Disallow Case Statement Fallthrough - "no-fallthrough": "error", - // Disallow Floating Decimals - "no-floating-decimal": "error", + "@stylistic/no-floating-decimal": "error", // Require Space Before Blocks - "space-before-blocks": "error", + "@stylistic/space-before-blocks": "error", // Operators always before the line break - "operator-linebreak": ["error", "after", { overrides: { ":": "before", "?": "ignore" } }], + "@stylistic/operator-linebreak": ["error", "after", { overrides: { ":": "before", "?": "ignore" } }], // Restricts the use of parentheses to only where they are necessary //"no-extra-parens": ["error", "all", { "conditionalAssign": false, "returnAssign": false, "nestedBinaryExpressions": false }], @@ -370,7 +260,7 @@ export default [ // Not more than two empty lines with in the file, and no extra lines at // beginning or end of file. - "no-multiple-empty-lines": ["error", { max: 2, maxEOF: 0, maxBOF: 0 }], + "@stylistic/no-multiple-empty-lines": ["error", { max: 2, maxEOF: 0, maxBOF: 0 }], // Make sure all setters have a corresponding getter "accessor-pairs": "error", @@ -379,7 +269,7 @@ export default [ //"block-spacing": ["error", "always"], // Disallow spaces inside of computed properties - "computed-property-spacing": ["error", "never"], + "@stylistic/computed-property-spacing": ["error", "never"], // Require consistent this (using |self|) "consistent-this": ["error", "self"], @@ -394,16 +284,13 @@ export default [ //"func-names": ["error", "never"], // Enforce placing object properties on separate lines - "object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }], + "@stylistic/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }], // Enforce consistent line breaks inside braces //"object-curly-newline": ["error", { "multiline": true }], // Disallow whitespace before properties - "no-whitespace-before-property": "error", - - // Disallow unnecessary escape usage - "no-useless-escape": "error", + "@stylistic/no-whitespace-before-property": "error", // Disallow mixes of different operators, but allow simple math operations. //"no-mixed-operators": ["error", { @@ -429,28 +316,23 @@ export default [ "prefer-spread": "error", // Quoting style for property names - //"quote-props": ["error", "consistent-as-needed", { "keywords": true }], + //"@stylistic/quote-props": ["error", "consistent-as-needed", { "keywords": true }], // Disallow negated conditions //"no-negated-condition": "error", // Enforce a maximum number of statements allowed per line - "max-statements-per-line": ["error", { max: 2 }], + "@stylistic/max-statements-per-line": ["error", { max: 2 }], // Disallow arrow functions where they could be confused with comparisons - "no-confusing-arrow": "error", + "@stylistic/no-confusing-arrow": "error", // Disallow Unnecessary Nested Blocks "no-lone-blocks": "error", - // Disallow lexical declarations in case/default clauses - "no-case-declarations": "error", - // Enforce consistent indentation (2-space) //"indent": ["error", 2, { "SwitchCase": 1 }], - "no-prototype-builtins": "error", - // Disallow var, use let or const instead "no-var": "error" } @@ -495,7 +377,7 @@ export default [ { files: ["eslint.config.js"], rules: { - "quote-props": ["error", "consistent-as-needed"] + "@stylistic/quote-props": ["error", "consistent-as-needed"] } } ]; diff --git a/package-lock.json b/package-lock.json index 47c0d7e5..557735ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "@eslint/js": "^9.0.0", "@octokit/core": "^6.0.1", "@rollup/plugin-babel": "^6.0.4", + "@stylistic/eslint-plugin-js": "^1.7.0", "benchmark": "^2.1.4", "c8": "^9.1.0", "chai": "^5.1.0", @@ -2536,6 +2537,54 @@ "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==", "dev": true }, + "node_modules/@stylistic/eslint-plugin-js": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-js/-/eslint-plugin-js-1.7.0.tgz", + "integrity": "sha512-PN6On/+or63FGnhhMKSQfYcWutRlzOiYlVdLM6yN7lquoBTqUJHYnl4TA4MHwiAt46X5gRxDr1+xPZ1lOLcL+Q==", + "dev": true, + "dependencies": { + "@types/eslint": "^8.56.2", + "acorn": "^8.11.3", + "escape-string-regexp": "^4.0.0", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "peerDependencies": { + "eslint": ">=8.40.0" + } + }, + "node_modules/@stylistic/eslint-plugin-js/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@stylistic/eslint-plugin-js/node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/@szmarczak/http-timer": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", @@ -2591,6 +2640,16 @@ "@types/node": "*" } }, + "node_modules/@types/eslint": { + "version": "8.56.7", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.7.tgz", + "integrity": "sha512-SjDvI/x3zsZnOkYZ3lCt9lOZWZLB2jIlNKz+LBgCtDurK0JZcwucxYHn1w2BJkD34dgX9Tjnak0txtq4WTggEA==", + "dev": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", @@ -2609,6 +2668,12 @@ "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", "dev": true }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, "node_modules/@types/keyv": { "version": "3.1.4", "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", @@ -9969,6 +10034,21 @@ "node": ">= 0.6" } }, + "node_modules/typescript": { + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.4.tgz", + "integrity": "sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==", + "dev": true, + "optional": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/ua-parser-js": { "version": "0.7.37", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.37.tgz", diff --git a/package.json b/package.json index b8abdd16..229b7a5a 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@eslint/js": "^9.0.0", "@octokit/core": "^6.0.1", "@rollup/plugin-babel": "^6.0.4", + "@stylistic/eslint-plugin-js": "^1.7.0", "benchmark": "^2.1.4", "c8": "^9.1.0", "chai": "^5.1.0",