@ocavue/eslint-config 2.16.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -22
- package/dist/antfu.d.ts +2 -0
- package/dist/antfu.js +15 -0
- package/dist/basic.d.ts +2 -0
- package/dist/basic.js +20 -0
- package/dist/ignores.d.ts +2 -0
- package/dist/ignores.js +8 -0
- package/dist/imports.d.ts +2 -0
- package/dist/imports.js +49 -0
- package/dist/index.d.ts +10 -7
- package/dist/index.js +27 -0
- package/dist/markdown.d.ts +2 -0
- package/dist/markdown.js +41 -0
- package/dist/no-only-tests.d.ts +2 -0
- package/dist/no-only-tests.js +14 -0
- package/dist/options.d.ts +21 -0
- package/dist/options.js +7 -0
- package/dist/package-json.d.ts +5 -0
- package/dist/package-json.js +70 -0
- package/dist/{src/prettier.d.ts → prettier.d.ts} +2 -2
- package/{src → dist}/prettier.js +9 -13
- package/dist/react.d.ts +2 -0
- package/dist/react.js +34 -0
- package/dist/shared.d.ts +23 -0
- package/dist/shared.js +49 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +1 -0
- package/dist/typescript.d.ts +4 -0
- package/dist/typescript.js +112 -0
- package/dist/unicorn.d.ts +2 -0
- package/dist/unicorn.js +71 -0
- package/dist/vue.d.ts +2 -0
- package/dist/vue.js +33 -0
- package/package.json +20 -24
- package/dist/eslint.config.d.ts +0 -3
- package/dist/eslint.config.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/src/antfu.d.ts +0 -2
- package/dist/src/antfu.d.ts.map +0 -1
- package/dist/src/basic.d.ts +0 -2
- package/dist/src/basic.d.ts.map +0 -1
- package/dist/src/ignores.d.ts +0 -2
- package/dist/src/ignores.d.ts.map +0 -1
- package/dist/src/imports.d.ts +0 -2
- package/dist/src/imports.d.ts.map +0 -1
- package/dist/src/markdown.d.ts +0 -2
- package/dist/src/markdown.d.ts.map +0 -1
- package/dist/src/no-only-tests.d.ts +0 -2
- package/dist/src/no-only-tests.d.ts.map +0 -1
- package/dist/src/package-json.d.ts +0 -5
- package/dist/src/package-json.d.ts.map +0 -1
- package/dist/src/prettier.d.ts.map +0 -1
- package/dist/src/react.d.ts +0 -2
- package/dist/src/react.d.ts.map +0 -1
- package/dist/src/shared.d.ts +0 -24
- package/dist/src/shared.d.ts.map +0 -1
- package/dist/src/typescript.d.ts +0 -4
- package/dist/src/typescript.d.ts.map +0 -1
- package/dist/src/unicorn.d.ts +0 -2
- package/dist/src/unicorn.d.ts.map +0 -1
- package/dist/src/vue.d.ts +0 -2
- package/dist/src/vue.d.ts.map +0 -1
- package/index.js +0 -6
- package/src/antfu.js +0 -19
- package/src/basic.js +0 -26
- package/src/ignores.js +0 -10
- package/src/imports.js +0 -55
- package/src/markdown.js +0 -63
- package/src/no-only-tests.js +0 -20
- package/src/package-json.js +0 -78
- package/src/react.js +0 -45
- package/src/shared.js +0 -61
- package/src/typescript.js +0 -128
- package/src/unicorn.js +0 -75
- package/src/vue.js +0 -46
package/src/no-only-tests.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import plugin from 'eslint-plugin-no-only-tests'
|
|
4
|
-
|
|
5
|
-
export function noOnlyTests() {
|
|
6
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
7
|
-
const config = [
|
|
8
|
-
{
|
|
9
|
-
name: 'no-only-tests',
|
|
10
|
-
plugins: {
|
|
11
|
-
'no-only-tests': plugin,
|
|
12
|
-
},
|
|
13
|
-
rules: {
|
|
14
|
-
'no-only-tests/no-only-tests': 'error',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
return config
|
|
20
|
-
}
|
package/src/package-json.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import pkgJson from 'eslint-plugin-package-json'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Sort package.json keys
|
|
7
|
-
*/
|
|
8
|
-
export function packageJson() {
|
|
9
|
-
const config = {
|
|
10
|
-
...pkgJson.configs.recommended,
|
|
11
|
-
rules: {
|
|
12
|
-
...pkgJson.configs.recommended.rules,
|
|
13
|
-
'package-json/no-empty-fields': 'off',
|
|
14
|
-
'package-json/valid-package-definition': 'off',
|
|
15
|
-
'package-json/require-description': 'warn',
|
|
16
|
-
'package-json/sort-collections': [
|
|
17
|
-
'warn',
|
|
18
|
-
[
|
|
19
|
-
// 'scripts', // Don't sort scripts
|
|
20
|
-
'devDependencies',
|
|
21
|
-
'dependencies',
|
|
22
|
-
'peerDependencies',
|
|
23
|
-
'config',
|
|
24
|
-
'exports',
|
|
25
|
-
],
|
|
26
|
-
],
|
|
27
|
-
'package-json/order-properties': [
|
|
28
|
-
'warn',
|
|
29
|
-
{
|
|
30
|
-
order: [
|
|
31
|
-
'name',
|
|
32
|
-
'displayName',
|
|
33
|
-
'publisher',
|
|
34
|
-
'type',
|
|
35
|
-
'version',
|
|
36
|
-
'private',
|
|
37
|
-
'packageManager',
|
|
38
|
-
'description',
|
|
39
|
-
'author',
|
|
40
|
-
'license',
|
|
41
|
-
'funding',
|
|
42
|
-
'homepage',
|
|
43
|
-
'repository',
|
|
44
|
-
'bugs',
|
|
45
|
-
'contributes',
|
|
46
|
-
'keywords',
|
|
47
|
-
'categories',
|
|
48
|
-
'sideEffects',
|
|
49
|
-
'main',
|
|
50
|
-
'module',
|
|
51
|
-
'types',
|
|
52
|
-
'exports',
|
|
53
|
-
'typesVersions',
|
|
54
|
-
'bin',
|
|
55
|
-
'icon',
|
|
56
|
-
'files',
|
|
57
|
-
'engines',
|
|
58
|
-
'scripts',
|
|
59
|
-
'dependencies',
|
|
60
|
-
'peerDependencies',
|
|
61
|
-
'peerDependenciesMeta',
|
|
62
|
-
'optionalDependencies',
|
|
63
|
-
'devDependencies',
|
|
64
|
-
'publishConfig',
|
|
65
|
-
'overrides',
|
|
66
|
-
'resolutions',
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
74
|
-
// @ts-expect-error: unmatched types
|
|
75
|
-
const configs = [config]
|
|
76
|
-
|
|
77
|
-
return configs
|
|
78
|
-
}
|
package/src/react.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import reactPlugin from 'eslint-plugin-react'
|
|
4
|
-
|
|
5
|
-
import reactHooksPlugin from 'eslint-plugin-react-hooks'
|
|
6
|
-
|
|
7
|
-
import { GLOB_TS, GLOB_TSX } from './shared.js'
|
|
8
|
-
|
|
9
|
-
/** @type {import('eslint').Linter.Config} */
|
|
10
|
-
const reactRecommended = reactPlugin.configs.flat?.recommended || {}
|
|
11
|
-
|
|
12
|
-
export function react() {
|
|
13
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
14
|
-
const config = [
|
|
15
|
-
{
|
|
16
|
-
...reactRecommended,
|
|
17
|
-
name: 'react',
|
|
18
|
-
files: [GLOB_TS, GLOB_TSX],
|
|
19
|
-
settings: {
|
|
20
|
-
react: {
|
|
21
|
-
version: 'detect',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
rules: {
|
|
25
|
-
...reactRecommended.rules,
|
|
26
|
-
'react/prop-types': 'off',
|
|
27
|
-
'react/react-in-jsx-scope': 'off',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
name: 'react-hooks',
|
|
33
|
-
files: [GLOB_TS, GLOB_TSX],
|
|
34
|
-
plugins: {
|
|
35
|
-
'react-hooks': reactHooksPlugin,
|
|
36
|
-
},
|
|
37
|
-
rules: {
|
|
38
|
-
'react-hooks/rules-of-hooks': 'error',
|
|
39
|
-
'react-hooks/exhaustive-deps': 'warn',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
]
|
|
43
|
-
|
|
44
|
-
return config
|
|
45
|
-
}
|
package/src/shared.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
export const GLOB_SRC_EXT = '?([cm])[jt]s?(x)'
|
|
4
|
-
export const GLOB_SRC = '**/*.?([cm])[jt]s?(x)'
|
|
5
|
-
|
|
6
|
-
export const GLOB_JS = '**/*.?([cm])js'
|
|
7
|
-
export const GLOB_JSX = '**/*.?([cm])jsx'
|
|
8
|
-
|
|
9
|
-
export const GLOB_TS = '**/*.?([cm])ts'
|
|
10
|
-
export const GLOB_TSX = '**/*.?([cm])tsx'
|
|
11
|
-
|
|
12
|
-
export const GLOB_TEST = '**/*.(spec|test).?([cm])[jt]s?(x)'
|
|
13
|
-
|
|
14
|
-
export const GLOB_STYLE = '**/*.{c,le,sc}ss'
|
|
15
|
-
export const GLOB_CSS = '**/*.css'
|
|
16
|
-
export const GLOB_LESS = '**/*.less'
|
|
17
|
-
export const GLOB_SCSS = '**/*.scss'
|
|
18
|
-
|
|
19
|
-
export const GLOB_JSON = '**/*.json'
|
|
20
|
-
export const GLOB_JSON5 = '**/*.json5'
|
|
21
|
-
export const GLOB_JSONC = '**/*.jsonc'
|
|
22
|
-
|
|
23
|
-
export const GLOB_MARKDOWN = '**/*.md'
|
|
24
|
-
export const GLOB_VUE = '**/*.vue'
|
|
25
|
-
export const GLOB_YAML = '**/*.y?(a)ml'
|
|
26
|
-
export const GLOB_HTML = '**/*.htm?(l)'
|
|
27
|
-
|
|
28
|
-
export const GLOB_ALL_SRC = /** @type {const} */ ([
|
|
29
|
-
GLOB_SRC,
|
|
30
|
-
GLOB_STYLE,
|
|
31
|
-
GLOB_JSON,
|
|
32
|
-
GLOB_JSON5,
|
|
33
|
-
GLOB_MARKDOWN,
|
|
34
|
-
GLOB_VUE,
|
|
35
|
-
GLOB_YAML,
|
|
36
|
-
GLOB_HTML,
|
|
37
|
-
])
|
|
38
|
-
|
|
39
|
-
export const GLOB_NODE_MODULES = /** @type {const} */ ('**/node_modules')
|
|
40
|
-
export const GLOB_LOCKFILE = /** @type {const} */ ([
|
|
41
|
-
'**/package-lock.json',
|
|
42
|
-
'**/yarn.lock',
|
|
43
|
-
'**/pnpm-lock.yaml',
|
|
44
|
-
])
|
|
45
|
-
export const GLOB_EXCLUDE = /** @type {const} */ ([
|
|
46
|
-
GLOB_NODE_MODULES,
|
|
47
|
-
...GLOB_LOCKFILE,
|
|
48
|
-
|
|
49
|
-
'**/fixtures',
|
|
50
|
-
'**/.changeset',
|
|
51
|
-
'**/CHANGELOG*.md',
|
|
52
|
-
'**/*.min.*',
|
|
53
|
-
'**/LICENSE*',
|
|
54
|
-
'**/__snapshots__',
|
|
55
|
-
'**/.tsup',
|
|
56
|
-
])
|
|
57
|
-
|
|
58
|
-
export const EXTENSIONS = /** @type {const} */ ['ts', 'js']
|
|
59
|
-
.flatMap((ext) => [ext, ext + 'x'])
|
|
60
|
-
.flatMap((ext) => [ext, 'm' + ext, 'c' + ext])
|
|
61
|
-
.flatMap((ext) => [ext, 'd.' + ext])
|
package/src/typescript.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import eslint from '@eslint/js'
|
|
4
|
-
import tseslint from 'typescript-eslint'
|
|
5
|
-
|
|
6
|
-
import { GLOB_JS, GLOB_JSX, GLOB_TEST, GLOB_TS, GLOB_TSX } from './shared.js'
|
|
7
|
-
|
|
8
|
-
export { tseslint }
|
|
9
|
-
|
|
10
|
-
export function typescript() {
|
|
11
|
-
const rules = [...tseslint.configs.recommended, ...tseslint.configs.stylistic]
|
|
12
|
-
.map((config) => config.rules || {})
|
|
13
|
-
.reduce((acc, cur) => ({ ...acc, ...cur }), {})
|
|
14
|
-
|
|
15
|
-
/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray} */
|
|
16
|
-
const config = [
|
|
17
|
-
eslint.configs.recommended,
|
|
18
|
-
{
|
|
19
|
-
name: 'typescript',
|
|
20
|
-
files: [GLOB_TS, GLOB_TSX, GLOB_JS, GLOB_JSX],
|
|
21
|
-
languageOptions: {
|
|
22
|
-
parser: tseslint.parser,
|
|
23
|
-
parserOptions: {
|
|
24
|
-
projectService: true,
|
|
25
|
-
sourceType: 'module',
|
|
26
|
-
ecmaVersion: 'latest',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
plugins: {
|
|
30
|
-
'@typescript-eslint': tseslint.plugin,
|
|
31
|
-
},
|
|
32
|
-
rules: {
|
|
33
|
-
...rules,
|
|
34
|
-
|
|
35
|
-
'@typescript-eslint/consistent-type-definitions': 'off',
|
|
36
|
-
'@typescript-eslint/prefer-optional-chain': 'off',
|
|
37
|
-
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
38
|
-
'@typescript-eslint/consistent-indexed-object-style': 'off',
|
|
39
|
-
'@typescript-eslint/array-type': 'off',
|
|
40
|
-
'@typescript-eslint/dot-notation': 'off',
|
|
41
|
-
'@typescript-eslint/triple-slash-reference': 'off',
|
|
42
|
-
'@typescript-eslint/consistent-type-imports': [
|
|
43
|
-
'warn',
|
|
44
|
-
{
|
|
45
|
-
// Allow type imports in type annotations (e.g. `type T = import('Foo').Foo`)
|
|
46
|
-
disallowTypeAnnotations: false,
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
'@typescript-eslint/no-import-type-side-effects': 'warn',
|
|
50
|
-
'@typescript-eslint/no-unnecessary-type-assertion': 'warn',
|
|
51
|
-
'@typescript-eslint/no-unnecessary-parameter-property-assignment':
|
|
52
|
-
'warn',
|
|
53
|
-
'@typescript-eslint/restrict-plus-operands': 'warn',
|
|
54
|
-
'@typescript-eslint/no-unsafe-call': 'warn',
|
|
55
|
-
'@typescript-eslint/no-unsafe-return': 'warn',
|
|
56
|
-
'@typescript-eslint/no-unsafe-argument': 'warn',
|
|
57
|
-
'@typescript-eslint/no-unsafe-member-access': 'warn',
|
|
58
|
-
'@typescript-eslint/no-unsafe-assignment': 'warn',
|
|
59
|
-
'@typescript-eslint/no-floating-promises': 'warn',
|
|
60
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
61
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
62
|
-
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
63
|
-
'@typescript-eslint/restrict-template-expressions': 'off',
|
|
64
|
-
'@typescript-eslint/no-unused-vars': [
|
|
65
|
-
'error',
|
|
66
|
-
{
|
|
67
|
-
argsIgnorePattern: '^_',
|
|
68
|
-
varsIgnorePattern: '^_',
|
|
69
|
-
caughtErrorsIgnorePattern: '^_',
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
'@typescript-eslint/no-extra-semi': 'off',
|
|
73
|
-
'@typescript-eslint/prefer-function-type': 'warn',
|
|
74
|
-
|
|
75
|
-
'@typescript-eslint/no-misused-promises': [
|
|
76
|
-
'error',
|
|
77
|
-
{ checksVoidReturn: false },
|
|
78
|
-
],
|
|
79
|
-
'@typescript-eslint/await-thenable': 'error',
|
|
80
|
-
'@typescript-eslint/unbound-method': 'error',
|
|
81
|
-
|
|
82
|
-
// `type T1 = T0` and `interface T2 extends T0 {}` have the same meaning
|
|
83
|
-
// but different behavior in TypeScript type checking. `T1` and `T0` are
|
|
84
|
-
// the same type, while `T2` is different than `T0`. We allow `interface
|
|
85
|
-
// T2 extends T0 {}` explicitly.
|
|
86
|
-
'@typescript-eslint/no-empty-object-type': [
|
|
87
|
-
'error',
|
|
88
|
-
{
|
|
89
|
-
allowInterfaces: 'with-single-extends',
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
|
|
93
|
-
// Turn off this rule because it's incompatible with the `--isolatedDeclarations` compiler option.
|
|
94
|
-
'@typescript-eslint/no-inferrable-types': 'off',
|
|
95
|
-
|
|
96
|
-
// TODO: We should set the rule below to error in the future
|
|
97
|
-
'@typescript-eslint/require-await': 'warn',
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
name: 'typescript-js',
|
|
102
|
-
files: [GLOB_JS, GLOB_JSX],
|
|
103
|
-
rules: {
|
|
104
|
-
'@typescript-eslint/no-require-imports': 'off',
|
|
105
|
-
'@typescript-eslint/no-var-requires': 'off',
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: 'typescript-test',
|
|
110
|
-
files: [GLOB_TEST],
|
|
111
|
-
rules: {
|
|
112
|
-
'@typescript-eslint/no-unsafe-call': 'warn',
|
|
113
|
-
'@typescript-eslint/no-unsafe-return': 'warn',
|
|
114
|
-
'@typescript-eslint/no-unsafe-argument': 'warn',
|
|
115
|
-
'@typescript-eslint/no-unsafe-member-access': 'warn',
|
|
116
|
-
'@typescript-eslint/no-unsafe-assignment': 'warn',
|
|
117
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
118
|
-
'@typescript-eslint/no-empty-function': 'off',
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
]
|
|
122
|
-
|
|
123
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
124
|
-
// @ts-expect-error: unmatched type
|
|
125
|
-
const configTyped = config
|
|
126
|
-
|
|
127
|
-
return configTyped
|
|
128
|
-
}
|
package/src/unicorn.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import plugin from 'eslint-plugin-unicorn'
|
|
4
|
-
|
|
5
|
-
export function unicorn() {
|
|
6
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
7
|
-
const config = [
|
|
8
|
-
{
|
|
9
|
-
name: 'unicorn',
|
|
10
|
-
plugins: {
|
|
11
|
-
unicorn: plugin,
|
|
12
|
-
},
|
|
13
|
-
rules: {
|
|
14
|
-
// Pass error message when throwing errors
|
|
15
|
-
'unicorn/error-message': 'error',
|
|
16
|
-
// Uppercase regex escapes
|
|
17
|
-
'unicorn/escape-case': 'error',
|
|
18
|
-
// Array.isArray instead of instanceof etc
|
|
19
|
-
'unicorn/no-instanceof-builtins': 'error',
|
|
20
|
-
// Prevent deprecated `new Buffer()`
|
|
21
|
-
'unicorn/no-new-buffer': 'error',
|
|
22
|
-
// Keep regex literals safe!
|
|
23
|
-
'unicorn/no-unsafe-regex': 'off',
|
|
24
|
-
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
25
|
-
'unicorn/number-literal-case': 'error',
|
|
26
|
-
// includes over indexOf when checking for existence
|
|
27
|
-
'unicorn/prefer-includes': 'error',
|
|
28
|
-
// String methods startsWith/endsWith instead of more complicated stuff
|
|
29
|
-
'unicorn/prefer-string-starts-ends-with': 'error',
|
|
30
|
-
// Enforce throwing type error when throwing error while checking typeof
|
|
31
|
-
'unicorn/prefer-type-error': 'error',
|
|
32
|
-
// Use new when throwing error
|
|
33
|
-
'unicorn/throw-new-error': 'error',
|
|
34
|
-
// Prefer using the node: protocol
|
|
35
|
-
'unicorn/prefer-node-protocol': 'error',
|
|
36
|
-
// Enforce explicitly comparing the length or size property of a value
|
|
37
|
-
'unicorn/explicit-length-check': 'error',
|
|
38
|
-
// Prefer `.flatMap(…)` over `.map(…).flat()`
|
|
39
|
-
'unicorn/prefer-array-index-of': 'error',
|
|
40
|
-
// Improve regexes
|
|
41
|
-
'unicorn/better-regex': 'error',
|
|
42
|
-
// Enforce combining multiple `Array#push()` into one call.
|
|
43
|
-
'unicorn/no-array-push-push': 'warn',
|
|
44
|
-
// Do not use a `for` loop that can be replaced with a `for-of` loop.
|
|
45
|
-
'unicorn/no-for-loop': 'error',
|
|
46
|
-
// Disallow eslint-disable comments without specific rule names
|
|
47
|
-
'unicorn/no-abusive-eslint-disable': 'error',
|
|
48
|
-
// Prefer `.addEventListener()` and `.removeEventListener()` over `on`-functions.
|
|
49
|
-
'unicorn/prefer-add-event-listener': 'error',
|
|
50
|
-
// Prefer `.find(…)` and `.findLast(…)` over the first or last element from
|
|
51
|
-
'unicorn/prefer-array-find': 'error',
|
|
52
|
-
// Prefer `.flatMap(…)` over `.map(…).flat()`.
|
|
53
|
-
'unicorn/prefer-array-flat-map': 'error',
|
|
54
|
-
// Prefer `.some(…)` over `.filter(…).length` check
|
|
55
|
-
'unicorn/prefer-array-some': 'error',
|
|
56
|
-
// Prefer `KeyboardEvent#key` over `KeyboardEvent#keyCode`
|
|
57
|
-
'unicorn/prefer-keyboard-event-key': 'error',
|
|
58
|
-
// Enforce the use of `Math.trunc` instead of bitwise operators.
|
|
59
|
-
'unicorn/prefer-math-trunc': 'error',
|
|
60
|
-
// Prefer negative index over `.length - index` when possible
|
|
61
|
-
'unicorn/prefer-negative-index': 'error',
|
|
62
|
-
// Prefer `Number` static properties over global ones.
|
|
63
|
-
'unicorn/prefer-number-properties': 'warn',
|
|
64
|
-
// Prefer `RegExp#test()` over `String#match()` and `RegExp#exec()`
|
|
65
|
-
'unicorn/prefer-regexp-test': 'warn',
|
|
66
|
-
// Prefer using `structuredClone` to create a deep clone
|
|
67
|
-
'unicorn/prefer-structured-clone': 'warn',
|
|
68
|
-
// Prefer using the `String.raw` tag to avoid escaping `\`
|
|
69
|
-
'unicorn/prefer-string-raw': 'warn',
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
]
|
|
73
|
-
|
|
74
|
-
return config
|
|
75
|
-
}
|
package/src/vue.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import prettierConfig from 'eslint-config-prettier'
|
|
4
|
-
import vuePlugin from 'eslint-plugin-vue'
|
|
5
|
-
import globals from 'globals'
|
|
6
|
-
import tseslint from 'typescript-eslint'
|
|
7
|
-
|
|
8
|
-
import { GLOB_VUE } from './shared.js'
|
|
9
|
-
|
|
10
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
11
|
-
const vueRecommended = vuePlugin.configs['flat/recommended']
|
|
12
|
-
|
|
13
|
-
export function vue() {
|
|
14
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
15
|
-
const config = [
|
|
16
|
-
...vueRecommended,
|
|
17
|
-
{
|
|
18
|
-
name: 'vue:language-options',
|
|
19
|
-
files: [GLOB_VUE],
|
|
20
|
-
languageOptions: {
|
|
21
|
-
ecmaVersion: 'latest',
|
|
22
|
-
sourceType: 'module',
|
|
23
|
-
globals: globals.browser,
|
|
24
|
-
parserOptions: {
|
|
25
|
-
parser: tseslint.parser,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'vue:rules-override',
|
|
31
|
-
rules: {
|
|
32
|
-
...Object.fromEntries(
|
|
33
|
-
Object.entries(prettierConfig.rules)
|
|
34
|
-
.filter(([key]) => key.startsWith('vue/'))
|
|
35
|
-
.map(([key, value]) => [key, value]),
|
|
36
|
-
),
|
|
37
|
-
|
|
38
|
-
'vue/multi-word-component-names': 'off',
|
|
39
|
-
'vue/one-component-per-file': 'off',
|
|
40
|
-
'vue/require-prop-types': 'off',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
]
|
|
44
|
-
|
|
45
|
-
return config
|
|
46
|
-
}
|