@sxzz/eslint-config
Advanced tools
Comparing version 3.6.1 to 3.6.2
@@ -19,14 +19,15 @@ // src/plugins.ts | ||
import * as parserJsonc from "jsonc-eslint-parser"; | ||
// @__NO_SIDE_EFFECTS__ | ||
function interopDefault(m) { | ||
return m.default || m; | ||
} | ||
var pluginAntfu = interopDefault(_pluginAntfu); | ||
var pluginComments = interopDefault(_pluginComments); | ||
var pluginMarkdown = interopDefault(_pluginMarkdown); | ||
var pluginTypeScript = interopDefault(_pluginTypeScript); | ||
var pluginUnicorn = interopDefault(_pluginUnicorn); | ||
var pluginVue = interopDefault(_pluginVue); | ||
var pluginUnocss = interopDefault(_pluginUnocss); | ||
var pluginPrettier = interopDefault(_pluginPrettier); | ||
var configPrettier = interopDefault(_configPrettier); | ||
var pluginAntfu = /* @__PURE__ */ interopDefault(_pluginAntfu); | ||
var pluginComments = /* @__PURE__ */ interopDefault(_pluginComments); | ||
var pluginMarkdown = /* @__PURE__ */ interopDefault(_pluginMarkdown); | ||
var pluginTypeScript = /* @__PURE__ */ interopDefault(_pluginTypeScript); | ||
var pluginUnicorn = /* @__PURE__ */ interopDefault(_pluginUnicorn); | ||
var pluginVue = /* @__PURE__ */ interopDefault(_pluginVue); | ||
var pluginUnocss = /* @__PURE__ */ interopDefault(_pluginUnocss); | ||
var pluginPrettier = /* @__PURE__ */ interopDefault(_pluginPrettier); | ||
var configPrettier = /* @__PURE__ */ interopDefault(_configPrettier); | ||
@@ -67,56 +68,42 @@ // src/configs/comments.ts | ||
var GLOB_HTML = "**/*.htm?(l)"; | ||
var GLOB_ALL_SRC = ( | ||
/** @type {const} */ | ||
[ | ||
GLOB_SRC, | ||
GLOB_STYLE, | ||
GLOB_JSON, | ||
GLOB_JSON5, | ||
GLOB_MARKDOWN, | ||
GLOB_VUE, | ||
GLOB_YAML, | ||
GLOB_HTML | ||
] | ||
); | ||
var GLOB_NODE_MODULES = ( | ||
/** @type {const} */ | ||
"**/node_modules" | ||
); | ||
var GLOB_DIST = ( | ||
/** @type {const} */ | ||
"**/dist" | ||
); | ||
var GLOB_LOCKFILE = ( | ||
/** @type {const} */ | ||
[ | ||
"**/package-lock.json", | ||
"**/yarn.lock", | ||
"**/pnpm-lock.yaml" | ||
] | ||
); | ||
var GLOB_EXCLUDE = ( | ||
/** @type {const} */ | ||
[ | ||
GLOB_NODE_MODULES, | ||
GLOB_DIST, | ||
...GLOB_LOCKFILE, | ||
"**/output", | ||
"**/coverage", | ||
"**/temp", | ||
"**/fixtures", | ||
"**/.vitepress/cache", | ||
"**/.nuxt", | ||
"**/.vercel", | ||
"**/.changeset", | ||
"**/.idea", | ||
"**/.output", | ||
"**/.vite-inspect", | ||
"**/CHANGELOG*.md", | ||
"**/*.min.*", | ||
"**/LICENSE*", | ||
"**/__snapshots__", | ||
"**/auto-import?(s).d.ts", | ||
"**/components.d.ts" | ||
] | ||
); | ||
var GLOB_ALL_SRC = [ | ||
GLOB_SRC, | ||
GLOB_STYLE, | ||
GLOB_JSON, | ||
GLOB_JSON5, | ||
GLOB_MARKDOWN, | ||
GLOB_VUE, | ||
GLOB_YAML, | ||
GLOB_HTML | ||
]; | ||
var GLOB_NODE_MODULES = "**/node_modules"; | ||
var GLOB_DIST = "**/dist"; | ||
var GLOB_LOCKFILE = [ | ||
"**/package-lock.json", | ||
"**/yarn.lock", | ||
"**/pnpm-lock.yaml", | ||
"**/bun.lockb" | ||
]; | ||
var GLOB_EXCLUDE = [ | ||
GLOB_NODE_MODULES, | ||
GLOB_DIST, | ||
...GLOB_LOCKFILE, | ||
"**/output", | ||
"**/coverage", | ||
"**/temp", | ||
"**/fixtures", | ||
"**/.vitepress/cache", | ||
"**/.nuxt", | ||
"**/.vercel", | ||
"**/.changeset", | ||
"**/.idea", | ||
"**/.output", | ||
"**/.vite-inspect", | ||
"**/CHANGELOG*.md", | ||
"**/*.min.*", | ||
"**/LICENSE*", | ||
"**/__snapshots__", | ||
"**/auto-import?(s).d.ts", | ||
"**/components.d.ts" | ||
]; | ||
@@ -130,6 +117,8 @@ // src/configs/ignores.ts | ||
plugins: { | ||
import: pluginImport, | ||
antfu: pluginAntfu | ||
antfu: pluginAntfu, | ||
import: pluginImport | ||
}, | ||
rules: { | ||
"antfu/import-dedupe": "error", | ||
"antfu/prefer-inline-type-import": "error", | ||
"import/first": "error", | ||
@@ -155,8 +144,6 @@ "import/no-default-export": "error", | ||
], | ||
pathGroups: [{ pattern: "{{@,~}/,#}**", group: "internal" }], | ||
pathGroups: [{ group: "internal", pattern: "{{@,~}/,#}**" }], | ||
pathGroupsExcludedImportTypes: ["type"] | ||
} | ||
], | ||
"antfu/import-dedupe": "error", | ||
"antfu/prefer-inline-type-import": "error" | ||
] | ||
} | ||
@@ -213,5 +200,10 @@ }, | ||
rules: { | ||
"array-callback-return": "error", | ||
"block-scoped-var": "error", | ||
"constructor-super": "error", | ||
"dot-notation": "warn", | ||
eqeqeq: ["error", "smart"], | ||
"for-direction": "error", | ||
"getter-return": "error", | ||
"no-alert": "warn", | ||
"no-async-promise-executor": "error", | ||
@@ -222,2 +214,3 @@ "no-case-declarations": "error", | ||
"no-cond-assign": "error", | ||
"no-console": ["warn", { allow: ["warn", "error"] }], | ||
"no-const-assign": "error", | ||
@@ -233,2 +226,3 @@ "no-constant-condition": "error", | ||
"no-duplicate-case": "error", | ||
"no-duplicate-imports": "error", | ||
"no-empty": ["error", { allowEmptyCatch: true }], | ||
@@ -246,5 +240,7 @@ "no-empty-character-class": "error", | ||
"no-irregular-whitespace": "error", | ||
"no-lonely-if": "error", | ||
"no-loss-of-precision": "error", | ||
"no-misleading-character-class": "error", | ||
"no-mixed-spaces-and-tabs": "error", | ||
"no-multi-str": "error", | ||
"no-new-symbol": "error", | ||
@@ -257,2 +253,9 @@ "no-nonoctal-decimal-escape": "error", | ||
"no-regex-spaces": "error", | ||
"no-restricted-syntax": [ | ||
"error", | ||
"ForInStatement", | ||
"LabeledStatement", | ||
"WithStatement" | ||
], | ||
"no-return-await": "warn", | ||
"no-self-assign": "error", | ||
@@ -269,2 +272,10 @@ "no-setter-return": "error", | ||
"no-unsafe-optional-chaining": "error", | ||
"no-unused-expressions": [ | ||
"error", | ||
{ | ||
allowShortCircuit: true, | ||
allowTaggedTemplates: true, | ||
allowTernary: true | ||
} | ||
], | ||
"no-unused-labels": "error", | ||
@@ -275,28 +286,9 @@ "no-unused-vars": "off", | ||
"no-useless-escape": "error", | ||
"no-void": "error", | ||
"no-with": "error", | ||
"require-yield": "error", | ||
"use-isnan": [ | ||
"object-shorthand": [ | ||
"error", | ||
{ enforceForIndexOf: true, enforceForSwitchCase: true } | ||
"always", | ||
{ avoidQuotes: true, ignoreConstructors: false } | ||
], | ||
"valid-typeof": ["error", { requireStringLiterals: true }], | ||
"no-console": ["warn", { allow: ["warn", "error"] }], | ||
"no-restricted-syntax": [ | ||
"error", | ||
"ForInStatement", | ||
"LabeledStatement", | ||
"WithStatement" | ||
], | ||
"no-return-await": "warn", | ||
"sort-imports": [ | ||
"error", | ||
{ | ||
ignoreCase: false, | ||
ignoreDeclarationSort: true, | ||
ignoreMemberSort: false, | ||
memberSyntaxSortOrder: ["none", "all", "multiple", "single"], | ||
allowSeparatedGroups: false | ||
} | ||
], | ||
"dot-notation": "warn", | ||
"prefer-arrow-callback": [ | ||
@@ -311,7 +303,2 @@ "error", | ||
"prefer-exponentiation-operator": "error", | ||
"object-shorthand": [ | ||
"error", | ||
"always", | ||
{ ignoreConstructors: false, avoidQuotes: true } | ||
], | ||
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }], | ||
@@ -322,20 +309,13 @@ "prefer-rest-params": "error", | ||
"require-await": "error", | ||
"array-callback-return": "error", | ||
"block-scoped-var": "error", | ||
eqeqeq: ["error", "smart"], | ||
"no-alert": "warn", | ||
"no-multi-str": "error", | ||
"no-void": "error", | ||
"no-duplicate-imports": "error", | ||
"no-unused-expressions": [ | ||
"require-yield": "error", | ||
"sort-imports": [ | ||
"error", | ||
{ | ||
allowShortCircuit: true, | ||
allowTernary: true, | ||
allowTaggedTemplates: true | ||
allowSeparatedGroups: false, | ||
ignoreCase: false, | ||
ignoreDeclarationSort: true, | ||
ignoreMemberSort: false, | ||
memberSyntaxSortOrder: ["none", "all", "multiple", "single"] | ||
} | ||
], | ||
"no-lonely-if": "error", | ||
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }], | ||
"vars-on-top": "error", | ||
"unicode-bom": ["error", "never"], | ||
@@ -346,3 +326,10 @@ "unused-imports/no-unused-imports": isInEditor ? "off" : "error", | ||
{ args: "after-used", ignoreRestSiblings: true } | ||
] | ||
], | ||
"use-isnan": [ | ||
"error", | ||
{ enforceForIndexOf: true, enforceForSwitchCase: true } | ||
], | ||
"valid-typeof": ["error", { requireStringLiterals: true }], | ||
"vars-on-top": "error", | ||
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }] | ||
} | ||
@@ -368,8 +355,8 @@ }, | ||
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC], | ||
languageOptions: { | ||
parser: parserJsonc | ||
}, | ||
plugins: { | ||
jsonc: pluginJsonc | ||
}, | ||
languageOptions: { | ||
parser: parserJsonc | ||
}, | ||
rules: { | ||
@@ -405,2 +392,3 @@ ...pluginJsonc.configs["recommended-with-jsonc"].rules, | ||
"@typescript-eslint/consistent-type-imports": "off", | ||
"@typescript-eslint/no-extraneous-class": "off", | ||
"@typescript-eslint/no-namespace": "off", | ||
@@ -412,3 +400,2 @@ "@typescript-eslint/no-redeclare": "off", | ||
"@typescript-eslint/no-var-requires": "off", | ||
"@typescript-eslint/no-extraneous-class": "off", | ||
"no-alert": "off", | ||
@@ -420,4 +407,4 @@ "no-console": "off", | ||
"no-unused-vars": "off", | ||
"unused-imports/no-unused-vars": "off", | ||
"unused-imports/no-unused-imports": "off" | ||
"unused-imports/no-unused-imports": "off", | ||
"unused-imports/no-unused-vars": "off" | ||
} | ||
@@ -451,4 +438,4 @@ } | ||
{ | ||
pathPattern: "^files$", | ||
order: { type: "asc" } | ||
order: { type: "asc" }, | ||
pathPattern: "^files$" | ||
} | ||
@@ -459,3 +446,2 @@ ], | ||
{ | ||
pathPattern: "^$", | ||
order: [ | ||
@@ -504,11 +490,12 @@ "name", | ||
"prettier" | ||
] | ||
], | ||
pathPattern: "^$" | ||
}, | ||
{ | ||
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$", | ||
order: { type: "asc" } | ||
order: { type: "asc" }, | ||
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$" | ||
}, | ||
{ | ||
pathPattern: "^exports.*$", | ||
order: ["types", "require", "import", "default"] | ||
order: ["types", "require", "import", "default"], | ||
pathPattern: "^exports.*$" | ||
}, | ||
@@ -661,3 +648,4 @@ { | ||
plugins: { | ||
"@typescript-eslint": pluginTypeScript | ||
"@typescript-eslint": pluginTypeScript, | ||
antfu: pluginAntfu | ||
}, | ||
@@ -667,3 +655,2 @@ rules: { | ||
...pluginTypeScript.configs.strict.rules, | ||
"@typescript-eslint/no-redeclare": "error", | ||
"@typescript-eslint/ban-ts-comment": "off", | ||
@@ -680,9 +667,15 @@ "@typescript-eslint/ban-types": "off", | ||
"error", | ||
{ fixStyle: "inline-type-imports", disallowTypeAnnotations: false } | ||
{ disallowTypeAnnotations: false, fixStyle: "inline-type-imports" } | ||
], | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-non-null-assertion": "off", | ||
"@typescript-eslint/no-redeclare": "error", | ||
// handled by unused-imports/no-unused-imports | ||
"@typescript-eslint/no-unused-vars": "off", | ||
"@typescript-eslint/prefer-as-const": "warn", | ||
// handled by unused-imports/no-unused-imports | ||
"@typescript-eslint/no-unused-vars": "off" | ||
"@typescript-eslint/prefer-literal-enum-member": [ | ||
"error", | ||
{ allowBitwiseExpressions: true } | ||
], | ||
"antfu/no-const-enum": "error" | ||
} | ||
@@ -813,7 +806,7 @@ }, | ||
$$: "readonly", | ||
$computed: "readonly", | ||
$customRef: "readonly", | ||
$ref: "readonly", | ||
$computed: "readonly", | ||
$shallowRef: "readonly", | ||
$toRef: "readonly", | ||
$customRef: "readonly" | ||
$toRef: "readonly" | ||
} | ||
@@ -830,7 +823,5 @@ }, | ||
var vueCustomRules = { | ||
"vue/max-attributes-per-line": "off", | ||
"vue/no-v-html": "off", | ||
"vue/multi-word-component-names": "off", | ||
"vue/require-prop-types": "off", | ||
"vue/require-default-prop": "off", | ||
"vue/block-order": ["error", { order: ["script", "template", "style"] }], | ||
"vue/custom-event-name-casing": ["error", "camelCase"], | ||
"vue/eqeqeq": ["error", "smart"], | ||
"vue/html-self-closing": [ | ||
@@ -840,18 +831,18 @@ "error", | ||
html: { | ||
void: "always", | ||
component: "always", | ||
normal: "always", | ||
component: "always" | ||
void: "always" | ||
}, | ||
svg: "always", | ||
math: "always" | ||
math: "always", | ||
svg: "always" | ||
} | ||
], | ||
"vue/block-order": ["error", { order: ["script", "template", "style"] }], | ||
"vue/custom-event-name-casing": ["error", "camelCase"], | ||
"vue/max-attributes-per-line": "off", | ||
"vue/multi-word-component-names": "off", | ||
"vue/no-constant-condition": "warn", | ||
"vue/no-empty-pattern": "error", | ||
"vue/no-loss-of-precision": "error", | ||
"vue/no-unused-refs": "error", | ||
"vue/no-useless-v-bind": "error", | ||
"vue/no-unused-refs": "error", | ||
"vue/padding-line-between-blocks": ["error", "always"], | ||
"vue/prefer-template": "error", | ||
"vue/eqeqeq": ["error", "smart"], | ||
"vue/no-constant-condition": "warn", | ||
"vue/no-v-html": "off", | ||
"vue/object-shorthand": [ | ||
@@ -861,8 +852,10 @@ "error", | ||
{ | ||
ignoreConstructors: false, | ||
avoidQuotes: true | ||
avoidQuotes: true, | ||
ignoreConstructors: false | ||
} | ||
], | ||
"vue/no-loss-of-precision": "error", | ||
"vue/no-empty-pattern": "error" | ||
"vue/padding-line-between-blocks": ["error", "always"], | ||
"vue/prefer-template": "error", | ||
"vue/require-default-prop": "off", | ||
"vue/require-prop-types": "off" | ||
}; | ||
@@ -884,17 +877,17 @@ var vue3Rules = { | ||
files: [GLOB_VUE], | ||
plugins: { | ||
vue: pluginVue, | ||
"@typescript-eslint": tsPlugin | ||
}, | ||
languageOptions: { | ||
parser: parserVue, | ||
parserOptions: { | ||
parser: "@typescript-eslint/parser", | ||
sourceType: "module", | ||
extraFileExtensions: [".vue"], | ||
ecmaFeatures: { | ||
jsx: true | ||
} | ||
}, | ||
extraFileExtensions: [".vue"], | ||
parser: "@typescript-eslint/parser", | ||
sourceType: "module" | ||
} | ||
}, | ||
plugins: { | ||
"@typescript-eslint": tsPlugin, | ||
vue: pluginVue | ||
}, | ||
processor: pluginVue.processors[".vue"], | ||
@@ -921,8 +914,8 @@ rules: { | ||
files: [GLOB_YAML], | ||
languageOptions: { | ||
parser: parserYml | ||
}, | ||
plugins: { | ||
yml: pluginYml | ||
}, | ||
languageOptions: { | ||
parser: parserYml | ||
}, | ||
rules: { | ||
@@ -929,0 +922,0 @@ ...pluginYml.configs.standard.rules, |
@@ -70,4 +70,4 @@ import { FlatESLintConfigItem } from 'eslint-define-config'; | ||
declare const GLOB_ALL_SRC: string[]; | ||
declare const GLOB_NODE_MODULES = /** @type {const} */ "**/node_modules"; | ||
declare const GLOB_DIST = /** @type {const} */ "**/dist"; | ||
declare const GLOB_NODE_MODULES: "**/node_modules"; | ||
declare const GLOB_DIST: "**/dist"; | ||
declare const GLOB_LOCKFILE: string[]; | ||
@@ -74,0 +74,0 @@ declare const GLOB_EXCLUDE: string[]; |
@@ -19,14 +19,15 @@ // src/plugins.ts | ||
import * as parserJsonc from "jsonc-eslint-parser"; | ||
// @__NO_SIDE_EFFECTS__ | ||
function interopDefault(m) { | ||
return m.default || m; | ||
} | ||
var pluginAntfu = interopDefault(_pluginAntfu); | ||
var pluginComments = interopDefault(_pluginComments); | ||
var pluginMarkdown = interopDefault(_pluginMarkdown); | ||
var pluginTypeScript = interopDefault(_pluginTypeScript); | ||
var pluginUnicorn = interopDefault(_pluginUnicorn); | ||
var pluginVue = interopDefault(_pluginVue); | ||
var pluginUnocss = interopDefault(_pluginUnocss); | ||
var pluginPrettier = interopDefault(_pluginPrettier); | ||
var configPrettier = interopDefault(_configPrettier); | ||
var pluginAntfu = /* @__PURE__ */ interopDefault(_pluginAntfu); | ||
var pluginComments = /* @__PURE__ */ interopDefault(_pluginComments); | ||
var pluginMarkdown = /* @__PURE__ */ interopDefault(_pluginMarkdown); | ||
var pluginTypeScript = /* @__PURE__ */ interopDefault(_pluginTypeScript); | ||
var pluginUnicorn = /* @__PURE__ */ interopDefault(_pluginUnicorn); | ||
var pluginVue = /* @__PURE__ */ interopDefault(_pluginVue); | ||
var pluginUnocss = /* @__PURE__ */ interopDefault(_pluginUnocss); | ||
var pluginPrettier = /* @__PURE__ */ interopDefault(_pluginPrettier); | ||
var configPrettier = /* @__PURE__ */ interopDefault(_configPrettier); | ||
@@ -67,56 +68,42 @@ // src/configs/comments.ts | ||
var GLOB_HTML = "**/*.htm?(l)"; | ||
var GLOB_ALL_SRC = ( | ||
/** @type {const} */ | ||
[ | ||
GLOB_SRC, | ||
GLOB_STYLE, | ||
GLOB_JSON, | ||
GLOB_JSON5, | ||
GLOB_MARKDOWN, | ||
GLOB_VUE, | ||
GLOB_YAML, | ||
GLOB_HTML | ||
] | ||
); | ||
var GLOB_NODE_MODULES = ( | ||
/** @type {const} */ | ||
"**/node_modules" | ||
); | ||
var GLOB_DIST = ( | ||
/** @type {const} */ | ||
"**/dist" | ||
); | ||
var GLOB_LOCKFILE = ( | ||
/** @type {const} */ | ||
[ | ||
"**/package-lock.json", | ||
"**/yarn.lock", | ||
"**/pnpm-lock.yaml" | ||
] | ||
); | ||
var GLOB_EXCLUDE = ( | ||
/** @type {const} */ | ||
[ | ||
GLOB_NODE_MODULES, | ||
GLOB_DIST, | ||
...GLOB_LOCKFILE, | ||
"**/output", | ||
"**/coverage", | ||
"**/temp", | ||
"**/fixtures", | ||
"**/.vitepress/cache", | ||
"**/.nuxt", | ||
"**/.vercel", | ||
"**/.changeset", | ||
"**/.idea", | ||
"**/.output", | ||
"**/.vite-inspect", | ||
"**/CHANGELOG*.md", | ||
"**/*.min.*", | ||
"**/LICENSE*", | ||
"**/__snapshots__", | ||
"**/auto-import?(s).d.ts", | ||
"**/components.d.ts" | ||
] | ||
); | ||
var GLOB_ALL_SRC = [ | ||
GLOB_SRC, | ||
GLOB_STYLE, | ||
GLOB_JSON, | ||
GLOB_JSON5, | ||
GLOB_MARKDOWN, | ||
GLOB_VUE, | ||
GLOB_YAML, | ||
GLOB_HTML | ||
]; | ||
var GLOB_NODE_MODULES = "**/node_modules"; | ||
var GLOB_DIST = "**/dist"; | ||
var GLOB_LOCKFILE = [ | ||
"**/package-lock.json", | ||
"**/yarn.lock", | ||
"**/pnpm-lock.yaml", | ||
"**/bun.lockb" | ||
]; | ||
var GLOB_EXCLUDE = [ | ||
GLOB_NODE_MODULES, | ||
GLOB_DIST, | ||
...GLOB_LOCKFILE, | ||
"**/output", | ||
"**/coverage", | ||
"**/temp", | ||
"**/fixtures", | ||
"**/.vitepress/cache", | ||
"**/.nuxt", | ||
"**/.vercel", | ||
"**/.changeset", | ||
"**/.idea", | ||
"**/.output", | ||
"**/.vite-inspect", | ||
"**/CHANGELOG*.md", | ||
"**/*.min.*", | ||
"**/LICENSE*", | ||
"**/__snapshots__", | ||
"**/auto-import?(s).d.ts", | ||
"**/components.d.ts" | ||
]; | ||
@@ -130,6 +117,8 @@ // src/configs/ignores.ts | ||
plugins: { | ||
import: pluginImport, | ||
antfu: pluginAntfu | ||
antfu: pluginAntfu, | ||
import: pluginImport | ||
}, | ||
rules: { | ||
"antfu/import-dedupe": "error", | ||
"antfu/prefer-inline-type-import": "error", | ||
"import/first": "error", | ||
@@ -155,8 +144,6 @@ "import/no-default-export": "error", | ||
], | ||
pathGroups: [{ pattern: "{{@,~}/,#}**", group: "internal" }], | ||
pathGroups: [{ group: "internal", pattern: "{{@,~}/,#}**" }], | ||
pathGroupsExcludedImportTypes: ["type"] | ||
} | ||
], | ||
"antfu/import-dedupe": "error", | ||
"antfu/prefer-inline-type-import": "error" | ||
] | ||
} | ||
@@ -213,5 +200,10 @@ }, | ||
rules: { | ||
"array-callback-return": "error", | ||
"block-scoped-var": "error", | ||
"constructor-super": "error", | ||
"dot-notation": "warn", | ||
eqeqeq: ["error", "smart"], | ||
"for-direction": "error", | ||
"getter-return": "error", | ||
"no-alert": "warn", | ||
"no-async-promise-executor": "error", | ||
@@ -222,2 +214,3 @@ "no-case-declarations": "error", | ||
"no-cond-assign": "error", | ||
"no-console": ["warn", { allow: ["warn", "error"] }], | ||
"no-const-assign": "error", | ||
@@ -233,2 +226,3 @@ "no-constant-condition": "error", | ||
"no-duplicate-case": "error", | ||
"no-duplicate-imports": "error", | ||
"no-empty": ["error", { allowEmptyCatch: true }], | ||
@@ -246,5 +240,7 @@ "no-empty-character-class": "error", | ||
"no-irregular-whitespace": "error", | ||
"no-lonely-if": "error", | ||
"no-loss-of-precision": "error", | ||
"no-misleading-character-class": "error", | ||
"no-mixed-spaces-and-tabs": "error", | ||
"no-multi-str": "error", | ||
"no-new-symbol": "error", | ||
@@ -257,2 +253,9 @@ "no-nonoctal-decimal-escape": "error", | ||
"no-regex-spaces": "error", | ||
"no-restricted-syntax": [ | ||
"error", | ||
"ForInStatement", | ||
"LabeledStatement", | ||
"WithStatement" | ||
], | ||
"no-return-await": "warn", | ||
"no-self-assign": "error", | ||
@@ -269,2 +272,10 @@ "no-setter-return": "error", | ||
"no-unsafe-optional-chaining": "error", | ||
"no-unused-expressions": [ | ||
"error", | ||
{ | ||
allowShortCircuit: true, | ||
allowTaggedTemplates: true, | ||
allowTernary: true | ||
} | ||
], | ||
"no-unused-labels": "error", | ||
@@ -275,28 +286,9 @@ "no-unused-vars": "off", | ||
"no-useless-escape": "error", | ||
"no-void": "error", | ||
"no-with": "error", | ||
"require-yield": "error", | ||
"use-isnan": [ | ||
"object-shorthand": [ | ||
"error", | ||
{ enforceForIndexOf: true, enforceForSwitchCase: true } | ||
"always", | ||
{ avoidQuotes: true, ignoreConstructors: false } | ||
], | ||
"valid-typeof": ["error", { requireStringLiterals: true }], | ||
"no-console": ["warn", { allow: ["warn", "error"] }], | ||
"no-restricted-syntax": [ | ||
"error", | ||
"ForInStatement", | ||
"LabeledStatement", | ||
"WithStatement" | ||
], | ||
"no-return-await": "warn", | ||
"sort-imports": [ | ||
"error", | ||
{ | ||
ignoreCase: false, | ||
ignoreDeclarationSort: true, | ||
ignoreMemberSort: false, | ||
memberSyntaxSortOrder: ["none", "all", "multiple", "single"], | ||
allowSeparatedGroups: false | ||
} | ||
], | ||
"dot-notation": "warn", | ||
"prefer-arrow-callback": [ | ||
@@ -311,7 +303,2 @@ "error", | ||
"prefer-exponentiation-operator": "error", | ||
"object-shorthand": [ | ||
"error", | ||
"always", | ||
{ ignoreConstructors: false, avoidQuotes: true } | ||
], | ||
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }], | ||
@@ -322,20 +309,13 @@ "prefer-rest-params": "error", | ||
"require-await": "error", | ||
"array-callback-return": "error", | ||
"block-scoped-var": "error", | ||
eqeqeq: ["error", "smart"], | ||
"no-alert": "warn", | ||
"no-multi-str": "error", | ||
"no-void": "error", | ||
"no-duplicate-imports": "error", | ||
"no-unused-expressions": [ | ||
"require-yield": "error", | ||
"sort-imports": [ | ||
"error", | ||
{ | ||
allowShortCircuit: true, | ||
allowTernary: true, | ||
allowTaggedTemplates: true | ||
allowSeparatedGroups: false, | ||
ignoreCase: false, | ||
ignoreDeclarationSort: true, | ||
ignoreMemberSort: false, | ||
memberSyntaxSortOrder: ["none", "all", "multiple", "single"] | ||
} | ||
], | ||
"no-lonely-if": "error", | ||
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }], | ||
"vars-on-top": "error", | ||
"unicode-bom": ["error", "never"], | ||
@@ -346,3 +326,10 @@ "unused-imports/no-unused-imports": isInEditor ? "off" : "error", | ||
{ args: "after-used", ignoreRestSiblings: true } | ||
] | ||
], | ||
"use-isnan": [ | ||
"error", | ||
{ enforceForIndexOf: true, enforceForSwitchCase: true } | ||
], | ||
"valid-typeof": ["error", { requireStringLiterals: true }], | ||
"vars-on-top": "error", | ||
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }] | ||
} | ||
@@ -368,8 +355,8 @@ }, | ||
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC], | ||
languageOptions: { | ||
parser: parserJsonc | ||
}, | ||
plugins: { | ||
jsonc: pluginJsonc | ||
}, | ||
languageOptions: { | ||
parser: parserJsonc | ||
}, | ||
rules: { | ||
@@ -405,2 +392,3 @@ ...pluginJsonc.configs["recommended-with-jsonc"].rules, | ||
"@typescript-eslint/consistent-type-imports": "off", | ||
"@typescript-eslint/no-extraneous-class": "off", | ||
"@typescript-eslint/no-namespace": "off", | ||
@@ -412,3 +400,2 @@ "@typescript-eslint/no-redeclare": "off", | ||
"@typescript-eslint/no-var-requires": "off", | ||
"@typescript-eslint/no-extraneous-class": "off", | ||
"no-alert": "off", | ||
@@ -420,4 +407,4 @@ "no-console": "off", | ||
"no-unused-vars": "off", | ||
"unused-imports/no-unused-vars": "off", | ||
"unused-imports/no-unused-imports": "off" | ||
"unused-imports/no-unused-imports": "off", | ||
"unused-imports/no-unused-vars": "off" | ||
} | ||
@@ -451,4 +438,4 @@ } | ||
{ | ||
pathPattern: "^files$", | ||
order: { type: "asc" } | ||
order: { type: "asc" }, | ||
pathPattern: "^files$" | ||
} | ||
@@ -459,3 +446,2 @@ ], | ||
{ | ||
pathPattern: "^$", | ||
order: [ | ||
@@ -504,11 +490,12 @@ "name", | ||
"prettier" | ||
] | ||
], | ||
pathPattern: "^$" | ||
}, | ||
{ | ||
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$", | ||
order: { type: "asc" } | ||
order: { type: "asc" }, | ||
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$" | ||
}, | ||
{ | ||
pathPattern: "^exports.*$", | ||
order: ["types", "require", "import", "default"] | ||
order: ["types", "require", "import", "default"], | ||
pathPattern: "^exports.*$" | ||
}, | ||
@@ -661,3 +648,4 @@ { | ||
plugins: { | ||
"@typescript-eslint": pluginTypeScript | ||
"@typescript-eslint": pluginTypeScript, | ||
antfu: pluginAntfu | ||
}, | ||
@@ -667,3 +655,2 @@ rules: { | ||
...pluginTypeScript.configs.strict.rules, | ||
"@typescript-eslint/no-redeclare": "error", | ||
"@typescript-eslint/ban-ts-comment": "off", | ||
@@ -680,9 +667,15 @@ "@typescript-eslint/ban-types": "off", | ||
"error", | ||
{ fixStyle: "inline-type-imports", disallowTypeAnnotations: false } | ||
{ disallowTypeAnnotations: false, fixStyle: "inline-type-imports" } | ||
], | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-non-null-assertion": "off", | ||
"@typescript-eslint/no-redeclare": "error", | ||
// handled by unused-imports/no-unused-imports | ||
"@typescript-eslint/no-unused-vars": "off", | ||
"@typescript-eslint/prefer-as-const": "warn", | ||
// handled by unused-imports/no-unused-imports | ||
"@typescript-eslint/no-unused-vars": "off" | ||
"@typescript-eslint/prefer-literal-enum-member": [ | ||
"error", | ||
{ allowBitwiseExpressions: true } | ||
], | ||
"antfu/no-const-enum": "error" | ||
} | ||
@@ -813,7 +806,7 @@ }, | ||
$$: "readonly", | ||
$computed: "readonly", | ||
$customRef: "readonly", | ||
$ref: "readonly", | ||
$computed: "readonly", | ||
$shallowRef: "readonly", | ||
$toRef: "readonly", | ||
$customRef: "readonly" | ||
$toRef: "readonly" | ||
} | ||
@@ -830,7 +823,5 @@ }, | ||
var vueCustomRules = { | ||
"vue/max-attributes-per-line": "off", | ||
"vue/no-v-html": "off", | ||
"vue/multi-word-component-names": "off", | ||
"vue/require-prop-types": "off", | ||
"vue/require-default-prop": "off", | ||
"vue/block-order": ["error", { order: ["script", "template", "style"] }], | ||
"vue/custom-event-name-casing": ["error", "camelCase"], | ||
"vue/eqeqeq": ["error", "smart"], | ||
"vue/html-self-closing": [ | ||
@@ -840,18 +831,18 @@ "error", | ||
html: { | ||
void: "always", | ||
component: "always", | ||
normal: "always", | ||
component: "always" | ||
void: "always" | ||
}, | ||
svg: "always", | ||
math: "always" | ||
math: "always", | ||
svg: "always" | ||
} | ||
], | ||
"vue/block-order": ["error", { order: ["script", "template", "style"] }], | ||
"vue/custom-event-name-casing": ["error", "camelCase"], | ||
"vue/max-attributes-per-line": "off", | ||
"vue/multi-word-component-names": "off", | ||
"vue/no-constant-condition": "warn", | ||
"vue/no-empty-pattern": "error", | ||
"vue/no-loss-of-precision": "error", | ||
"vue/no-unused-refs": "error", | ||
"vue/no-useless-v-bind": "error", | ||
"vue/no-unused-refs": "error", | ||
"vue/padding-line-between-blocks": ["error", "always"], | ||
"vue/prefer-template": "error", | ||
"vue/eqeqeq": ["error", "smart"], | ||
"vue/no-constant-condition": "warn", | ||
"vue/no-v-html": "off", | ||
"vue/object-shorthand": [ | ||
@@ -861,8 +852,10 @@ "error", | ||
{ | ||
ignoreConstructors: false, | ||
avoidQuotes: true | ||
avoidQuotes: true, | ||
ignoreConstructors: false | ||
} | ||
], | ||
"vue/no-loss-of-precision": "error", | ||
"vue/no-empty-pattern": "error" | ||
"vue/padding-line-between-blocks": ["error", "always"], | ||
"vue/prefer-template": "error", | ||
"vue/require-default-prop": "off", | ||
"vue/require-prop-types": "off" | ||
}; | ||
@@ -884,17 +877,17 @@ var vue3Rules = { | ||
files: [GLOB_VUE], | ||
plugins: { | ||
vue: pluginVue, | ||
"@typescript-eslint": tsPlugin | ||
}, | ||
languageOptions: { | ||
parser: parserVue, | ||
parserOptions: { | ||
parser: "@typescript-eslint/parser", | ||
sourceType: "module", | ||
extraFileExtensions: [".vue"], | ||
ecmaFeatures: { | ||
jsx: true | ||
} | ||
}, | ||
extraFileExtensions: [".vue"], | ||
parser: "@typescript-eslint/parser", | ||
sourceType: "module" | ||
} | ||
}, | ||
plugins: { | ||
"@typescript-eslint": tsPlugin, | ||
vue: pluginVue | ||
}, | ||
processor: pluginVue.processors[".vue"], | ||
@@ -921,8 +914,8 @@ rules: { | ||
files: [GLOB_YAML], | ||
languageOptions: { | ||
parser: parserYml | ||
}, | ||
plugins: { | ||
yml: pluginYml | ||
}, | ||
languageOptions: { | ||
parser: parserYml | ||
}, | ||
rules: { | ||
@@ -929,0 +922,0 @@ ...pluginYml.configs.standard.rules, |
{ | ||
"name": "@sxzz/eslint-config", | ||
"version": "3.6.1", | ||
"packageManager": "pnpm@8.7.6", | ||
"version": "3.6.2", | ||
"packageManager": "pnpm@8.8.0", | ||
"description": "ESLint config for @sxzz.", | ||
@@ -16,2 +16,3 @@ "type": "module", | ||
}, | ||
"funding": "https://github.com/sponsors/sxzz", | ||
"files": [ | ||
@@ -34,8 +35,8 @@ "dist" | ||
"dependencies": { | ||
"@typescript-eslint/eslint-plugin": "^6.7.2", | ||
"@typescript-eslint/parser": "^6.7.2", | ||
"@unocss/eslint-plugin": "^0.55.7", | ||
"@typescript-eslint/eslint-plugin": "^6.7.3", | ||
"@typescript-eslint/parser": "^6.7.3", | ||
"@unocss/eslint-plugin": "^0.56.4", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-define-config": "^1.23.0", | ||
"eslint-plugin-antfu": "^0.42.1", | ||
"eslint-plugin-antfu": "^0.43.1", | ||
"eslint-plugin-eslint-comments": "^3.2.0", | ||
@@ -52,3 +53,3 @@ "eslint-plugin-i": "^2.28.1", | ||
"jsonc-eslint-parser": "^2.3.0", | ||
"local-pkg": "^0.4.3", | ||
"local-pkg": "^0.5.0", | ||
"prettier": "^3.0.3", | ||
@@ -60,5 +61,6 @@ "vue-eslint-parser": "^9.3.1", | ||
"@sxzz/prettier-config": "^1.0.4", | ||
"@types/node": "^20.6.3", | ||
"@types/node": "^20.8.0", | ||
"bumpp": "^9.2.0", | ||
"eslint": "^8.49.0", | ||
"eslint": "^8.50.0", | ||
"eslint-plugin-sort-keys": "^2.3.5", | ||
"sucrase": "^3.34.0", | ||
@@ -65,0 +67,0 @@ "tsup": "^7.2.0", |
@@ -9,5 +9,8 @@ # @sxzz/eslint-config [![npm](https://img.shields.io/npm/v/@sxzz/eslint-config.svg)](https://npmjs.com/package/@sxzz/eslint-config) | ||
- Support Vue 2 and 3 out-of-box. | ||
- Select the required file types as needed. | ||
- Format with Prettier. | ||
- Designed to work with TypeScript, Vue 2 and 3 out-of-box. | ||
- Support JSON(5), YAML, Markdown... | ||
- Sort imports, `package.json`, `tsconfig.json`... | ||
- [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily! | ||
- Reasonable defaults, best practices, only one-line of config | ||
@@ -39,3 +42,3 @@ ## Install | ||
], | ||
{ vue: true, prettier: true, markdown: true } | ||
{ vue: true, prettier: true, markdown: true, unocss: false } | ||
) | ||
@@ -52,2 +55,11 @@ ``` | ||
## Comparing to [`@antfu/eslint-config`](https://github.com/antfu/eslint-config) | ||
Most of the rules are the same, but there are some differences: | ||
- Use Prettier instead of [ESLint Stylistic](https://github.com/eslint-stylistic/eslint-stylistic). | ||
- Support both Vue 2 and Vue 3. | ||
- Support Vue Reactivity Transform. | ||
- More stricter rules. | ||
## Sponsors | ||
@@ -54,0 +66,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
98335
73
8
3157
+ Added@unocss/config@0.56.5(transitive)
+ Added@unocss/core@0.56.5(transitive)
+ Added@unocss/eslint-plugin@0.56.5(transitive)
+ Addedconfbox@0.1.7(transitive)
+ Addedeslint-plugin-antfu@0.43.1(transitive)
+ Addedlocal-pkg@0.5.0(transitive)
+ Addedmlly@1.7.1(transitive)
+ Addedpathe@1.1.2(transitive)
+ Addedpkg-types@1.1.1(transitive)
+ Addedufo@1.5.3(transitive)
- Removed@unocss/config@0.55.7(transitive)
- Removed@unocss/core@0.55.7(transitive)
- Removed@unocss/eslint-plugin@0.55.7(transitive)
- Removedeslint-plugin-antfu@0.42.1(transitive)
- Removedlocal-pkg@0.4.3(transitive)
Updatedeslint-plugin-antfu@^0.43.1
Updatedlocal-pkg@^0.5.0