Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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']
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/define-macros-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-unused-refs.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ module.exports = {
}
case 'CallExpression': {
const argIndex = parent.arguments.indexOf(node)
if (argIndex > -1) {
if (argIndex !== -1) {
// `foo($refs)`
hasUnknown = true
}
Expand Down
16 changes: 8 additions & 8 deletions lib/utils/indent-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1531,20 +1531,20 @@ 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: [
...tokens.slice(fromIndex + 1),
tokenStore.getFirstToken(node.source)
]
}
: {
fromToken: null,
beforeTokens: [...tokens, tokenStore.getFirstToken(node.source)],
afterTokens: []
}

/** @type {ImportSpecifier[]} */
const namedSpecifiers = []
Expand All @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/indent-ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/property-references.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}.`
)
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
}
Loading