From 207eb981df3bbab5d63846d7456d0925ab82394c Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Fri, 25 Oct 2024 10:53:55 +0200 Subject: [PATCH] Update development dependencies (#2582) --- eslint.config.js | 33 ++++++++++++++++++++------------ lib/rules/define-macros-order.js | 2 +- lib/rules/no-unused-refs.js | 2 +- lib/utils/indent-common.js | 16 ++++++++-------- lib/utils/indent-ts.js | 2 +- lib/utils/property-references.js | 2 +- lib/utils/selector.js | 2 +- package.json | 22 ++++++++++----------- 8 files changed, 45 insertions(+), 36 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 5ddca6175..ea76a9d73 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -42,6 +42,27 @@ module.exports = [ } }, + // turn off some rules from shared configs in all files + { + rules: { + 'eslint-plugin/require-meta-docs-recommended': 'off', // use `categories` instead + 'eslint-plugin/require-meta-schema-description': 'off', + + 'unicorn/filename-case': 'off', + 'unicorn/no-null': 'off', + 'unicorn/no-array-callback-reference': 'off', // doesn't work well with TypeScript's custom type guards + 'unicorn/no-useless-undefined': 'off', + 'unicorn/prefer-global-this': 'off', + 'unicorn/prefer-module': 'off', + 'unicorn/prefer-optional-catch-binding': 'off', // not supported by current ESLint parser version + 'unicorn/prefer-at': 'off', // turn off to prevent make breaking changes (ref: #2146) + 'unicorn/prefer-node-protocol': 'off', // turn off to prevent make breaking changes (ref: #2146) + 'unicorn/prefer-string-replace-all': 'off', // turn off to prevent make breaking changes (ref: #2146) + 'unicorn/prefer-top-level-await': 'off', // turn off to prevent make breaking changes (ref: #2146) + 'unicorn/prevent-abbreviations': 'off' + } + }, + { files: ['**/*.js'], languageOptions: { @@ -143,7 +164,6 @@ module.exports = [ 'error', { pattern: '^(enforce|require|disallow).*[^.]$' } ], - 'eslint-plugin/require-meta-docs-recommended': 'off', // use `categories` instead 'eslint-plugin/require-meta-fixable': [ 'error', { catchNoFixerButFixableProperty: true } @@ -184,17 +204,6 @@ module.exports = [ 'error', { checkArrowFunctions: false } ], - 'unicorn/filename-case': 'off', - 'unicorn/no-null': 'off', - 'unicorn/no-array-callback-reference': 'off', // doesn't work well with TypeScript's custom type guards - 'unicorn/no-useless-undefined': 'off', - 'unicorn/prefer-optional-catch-binding': 'off', // not supported by current ESLint parser version - 'unicorn/prefer-module': 'off', - 'unicorn/prevent-abbreviations': 'off', - 'unicorn/prefer-at': 'off', // turn off to prevent make breaking changes (ref: #2146) - 'unicorn/prefer-node-protocol': 'off', // turn off to prevent make breaking changes (ref: #2146) - 'unicorn/prefer-string-replace-all': 'off', // turn off to prevent make breaking changes (ref: #2146) - 'unicorn/prefer-top-level-await': 'off', // turn off to prevent make breaking changes (ref: #2146) 'internal/require-eslint-community': ['error'] } diff --git a/lib/rules/define-macros-order.js b/lib/rules/define-macros-order.js index 920b5c294..55e6140cd 100644 --- a/lib/rules/define-macros-order.js +++ b/lib/rules/define-macros-order.js @@ -193,7 +193,7 @@ function create(context) { const targetStatementIndex = moveTargetNodes.indexOf(targetStatement) - if (targetStatementIndex >= 0) { + if (targetStatementIndex !== -1) { moveTargetNodes = moveTargetNodes.slice(0, targetStatementIndex) } reportNotOnTop(should.name, moveTargetNodes, targetStatement) diff --git a/lib/rules/no-unused-refs.js b/lib/rules/no-unused-refs.js index 79d82a39d..4896ce25a 100644 --- a/lib/rules/no-unused-refs.js +++ b/lib/rules/no-unused-refs.js @@ -128,7 +128,7 @@ module.exports = { } case 'CallExpression': { const argIndex = parent.arguments.indexOf(node) - if (argIndex > -1) { + if (argIndex !== -1) { // `foo($refs)` hasUnknown = true } diff --git a/lib/utils/indent-common.js b/lib/utils/indent-common.js index bacf43e15..d2879b120 100644 --- a/lib/utils/indent-common.js +++ b/lib/utils/indent-common.js @@ -1531,8 +1531,13 @@ module.exports.defineVisitor = function create( const tokens = tokenStore.getTokensBetween(importToken, node.source) const fromIndex = tokens.map((t) => t.value).lastIndexOf('from') const { fromToken, beforeTokens, afterTokens } = - fromIndex >= 0 + fromIndex === -1 ? { + fromToken: null, + beforeTokens: [...tokens, tokenStore.getFirstToken(node.source)], + afterTokens: [] + } + : { fromToken: tokens[fromIndex], beforeTokens: tokens.slice(0, fromIndex), afterTokens: [ @@ -1540,11 +1545,6 @@ module.exports.defineVisitor = function create( tokenStore.getFirstToken(node.source) ] } - : { - fromToken: null, - beforeTokens: [...tokens, tokenStore.getFirstToken(node.source)], - afterTokens: [] - } /** @type {ImportSpecifier[]} */ const namedSpecifiers = [] @@ -1556,7 +1556,7 @@ module.exports.defineVisitor = function create( removeTokens.shift() for (const token of removeTokens) { const i = beforeTokens.indexOf(token) - if (i >= 0) { + if (i !== -1) { beforeTokens.splice(i, 1) } } @@ -1576,7 +1576,7 @@ module.exports.defineVisitor = function create( rightBrace ]) { const i = beforeTokens.indexOf(token) - if (i >= 0) { + if (i !== -1) { beforeTokens.splice(i, 1) } } diff --git a/lib/utils/indent-ts.js b/lib/utils/indent-ts.js index f021e8a10..314858c9a 100644 --- a/lib/utils/indent-ts.js +++ b/lib/utils/indent-ts.js @@ -663,7 +663,7 @@ function defineVisitor({ const [, ...removeTokens] = tokenStore.getTokens(child) for (const token of removeTokens) { const i = afterTokens.indexOf(token) - if (i >= 0) { + if (i !== -1) { afterTokens.splice(i, 1) } } diff --git a/lib/utils/property-references.js b/lib/utils/property-references.js index 57fe59975..99c73293b 100644 --- a/lib/utils/property-references.js +++ b/lib/utils/property-references.js @@ -343,7 +343,7 @@ function definePropertyReferenceExtractor( case 'CallExpression': { const argIndex = parent.arguments.indexOf(node) // `foo(arg)` - return !withInTemplate && argIndex > -1 + return !withInTemplate && argIndex !== -1 ? extractFromCall(parent, argIndex) : NEVER } diff --git a/lib/utils/selector.js b/lib/utils/selector.js index 7b1f15c3f..b5aa1adfc 100644 --- a/lib/utils/selector.js +++ b/lib/utils/selector.js @@ -543,7 +543,7 @@ function parseNth(pseudoNode) { .toLowerCase() const openParenIndex = argumentsText.indexOf('(') const closeParenIndex = argumentsText.lastIndexOf(')') - if (openParenIndex < 0 || closeParenIndex < 0) { + if (openParenIndex === -1 || closeParenIndex === -1) { throw new SelectorError( `Cannot parse An+B micro syntax (:nth-xxx() argument): ${argumentsText}.` ) diff --git a/package.json b/package.json index 626268933..28ba4bd78 100644 --- a/package.json +++ b/package.json @@ -67,9 +67,9 @@ }, "devDependencies": { "@ota-meshi/site-kit-eslint-editor-vue": "^0.2.4", - "@stylistic/eslint-plugin": "^2.6.0", + "@stylistic/eslint-plugin": "^2.9.0", "@types/eslint": "^8.56.2", - "@types/eslint-visitor-keys": "^3.3.0", + "@types/eslint-visitor-keys": "^3.3.2", "@types/natural-compare": "^1.4.3", "@types/node": "^14.18.63", "@types/semver": "^7.5.8", @@ -78,24 +78,24 @@ "@typescript-eslint/types": "^7.18.0", "assert": "^2.1.0", "env-cmd": "^10.1.0", - "esbuild": "^0.23.0", + "esbuild": "^0.24.0", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-eslint-plugin": "~6.2.0", - "eslint-plugin-import": "^2.29.1", + "eslint-plugin-eslint-plugin": "~6.3.1", + "eslint-plugin-import": "^2.31.0", "eslint-plugin-jsonc": "^2.16.0", "eslint-plugin-node-dependencies": "^0.12.0", "eslint-plugin-prettier": "^5.2.1", - "eslint-plugin-unicorn": "^55.0.0", + "eslint-plugin-unicorn": "^56.0.0", "eslint-plugin-vue": "file:.", "espree": "^9.6.1", "events": "^3.3.0", - "markdownlint-cli": "^0.41.0", - "mocha": "^10.7.0", - "nyc": "^17.0.0", + "markdownlint-cli": "^0.42.0", + "mocha": "^10.7.3", + "nyc": "^17.1.0", "pathe": "^1.1.2", "prettier": "^3.3.3", - "typescript": "^5.5.4", - "vitepress": "^1.3.1" + "typescript": "^5.6.3", + "vitepress": "^1.4.1" } }