@1stg/eslint-config 11.0.0 → 12.0.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/CHANGELOG.md +73 -0
- package/README.md +62 -1
- package/lib/index.d.ts +15 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +107 -0
- package/lib/index.js.map +1 -0
- package/package.json +28 -67
- package/_util.js +0 -86
- package/angular.js +0 -43
- package/base.d.ts +0 -3
- package/base.js +0 -206
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/jest.js +0 -17
- package/js-base.js +0 -47
- package/js.js +0 -22
- package/loose.d.ts +0 -3
- package/loose.js +0 -39
- package/overrides.d.ts +0 -25
- package/overrides.js +0 -252
- package/react.js +0 -67
- package/recommended.d.ts +0 -3
- package/recommended.js +0 -6
- package/test.js +0 -14
- package/ts-base.js +0 -139
- package/vitest.js +0 -17
- package/vue.js +0 -58
package/base.js
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
/** @import { TSESLint } from '@typescript-eslint/utils' */
|
|
4
|
-
|
|
5
|
-
import eslint from '@eslint/js'
|
|
6
|
-
import eslintCommentsConfigs from '@eslint-community/eslint-plugin-eslint-comments/configs'
|
|
7
|
-
import { isPkgAvailable, tryRequirePkg } from '@pkgr/utils'
|
|
8
|
-
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
|
|
9
|
-
import css from 'eslint-plugin-css'
|
|
10
|
-
import importX from 'eslint-plugin-import-x'
|
|
11
|
-
import { getGlobals } from 'eslint-plugin-mdx'
|
|
12
|
-
import n from 'eslint-plugin-n'
|
|
13
|
-
import promise from 'eslint-plugin-promise'
|
|
14
|
-
import regexp from 'eslint-plugin-regexp'
|
|
15
|
-
import simpleImportSort from 'eslint-plugin-simple-import-sort'
|
|
16
|
-
import sonarjs from 'eslint-plugin-sonarjs'
|
|
17
|
-
import unicornX from 'eslint-plugin-unicorn-x'
|
|
18
|
-
import globals from 'globals'
|
|
19
|
-
import tseslint from 'typescript-eslint'
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
isEslintNodeDepsEnabled,
|
|
23
|
-
isTsAvailable,
|
|
24
|
-
isWebpackAvailable,
|
|
25
|
-
magicNumbers,
|
|
26
|
-
webpackSpecVars,
|
|
27
|
-
prettierExtends,
|
|
28
|
-
} from './_util.js'
|
|
29
|
-
|
|
30
|
-
export const base = tseslint.config([
|
|
31
|
-
eslint.configs.recommended,
|
|
32
|
-
eslintCommentsConfigs.recommended,
|
|
33
|
-
css.configs['flat/recommended'],
|
|
34
|
-
importX.flatConfigs.recommended,
|
|
35
|
-
n.configs['flat/recommended'],
|
|
36
|
-
promise.configs['flat/recommended'],
|
|
37
|
-
regexp.configs['flat/recommended'],
|
|
38
|
-
/** @type {TSESLint.FlatConfig.SharedConfigs} */ (sonarjs.configs)
|
|
39
|
-
.recommended,
|
|
40
|
-
unicornX.configs.recommended,
|
|
41
|
-
prettierExtends,
|
|
42
|
-
isEslintNodeDepsEnabled && isPkgAvailable('eslint-plugin-node-dependencies')
|
|
43
|
-
? [
|
|
44
|
-
/** @type {typeof import('eslint-plugin-node-dependencies')} */ (
|
|
45
|
-
tryRequirePkg('eslint-plugin-node-dependencies')
|
|
46
|
-
).configs['flat/recommended'],
|
|
47
|
-
]
|
|
48
|
-
: [],
|
|
49
|
-
{
|
|
50
|
-
name: '@1stg/node',
|
|
51
|
-
files: ['**/*.{cjs,cts}'],
|
|
52
|
-
languageOptions: {
|
|
53
|
-
globals: globals.node,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: '@1stg/base',
|
|
58
|
-
plugins: {
|
|
59
|
-
'simple-import-sort': simpleImportSort,
|
|
60
|
-
},
|
|
61
|
-
settings: {
|
|
62
|
-
'import-x/external-module-folders': [
|
|
63
|
-
'node_modules',
|
|
64
|
-
'node_modules/@d-ts',
|
|
65
|
-
'node_modules/@types',
|
|
66
|
-
],
|
|
67
|
-
'import-x/resolver-next': createTypeScriptImportResolver(),
|
|
68
|
-
n: {
|
|
69
|
-
convertPath: {
|
|
70
|
-
'**/bin.*ts': [String.raw`^(src/)?bin\.([cm]?)ts$`, 'lib/bin.$2js'],
|
|
71
|
-
'**/cli.*ts': [String.raw`^(src/)?cli\.([cm]?)ts$`, 'lib/cli.$2js'],
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
languageOptions: {
|
|
76
|
-
sourceType: 'module',
|
|
77
|
-
ecmaVersion: 'latest',
|
|
78
|
-
globals: {
|
|
79
|
-
...globals.builtin,
|
|
80
|
-
...(isWebpackAvailable && getGlobals(webpackSpecVars)),
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
rules: {
|
|
84
|
-
'@eslint-community/eslint-comments/disable-enable-pair': [
|
|
85
|
-
2,
|
|
86
|
-
{
|
|
87
|
-
allowWholeFile: true,
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
'@eslint-community/eslint-comments/no-unused-disable': 2,
|
|
91
|
-
'arrow-body-style': 2,
|
|
92
|
-
camelcase: [
|
|
93
|
-
2,
|
|
94
|
-
{
|
|
95
|
-
properties: 'never',
|
|
96
|
-
ignoreDestructuring: true,
|
|
97
|
-
allow: isWebpackAvailable ? webpackSpecVars : undefined,
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
curly: [2, 'all'],
|
|
101
|
-
'import-x/first': 2,
|
|
102
|
-
'import-x/newline-after-import': 2,
|
|
103
|
-
'import-x/no-duplicates': 2,
|
|
104
|
-
'import-x/order': [
|
|
105
|
-
2,
|
|
106
|
-
{
|
|
107
|
-
alphabetize: {
|
|
108
|
-
order: 'asc',
|
|
109
|
-
},
|
|
110
|
-
'newlines-between': 'always',
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
'no-control-regex': 0, // replaced by sonarjs/no-control-regex
|
|
114
|
-
'no-else-return': [
|
|
115
|
-
2,
|
|
116
|
-
{
|
|
117
|
-
allowElseIf: false,
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
'no-empty': [
|
|
121
|
-
2,
|
|
122
|
-
{
|
|
123
|
-
allowEmptyCatch: true,
|
|
124
|
-
},
|
|
125
|
-
],
|
|
126
|
-
'no-empty-function': 2,
|
|
127
|
-
'no-labels': isTsAvailable ? 0 : 2, // sonar/no-labels
|
|
128
|
-
'no-magic-numbers': [
|
|
129
|
-
2,
|
|
130
|
-
{
|
|
131
|
-
enforceConst: true,
|
|
132
|
-
ignore: magicNumbers,
|
|
133
|
-
ignoreArrayIndexes: true,
|
|
134
|
-
},
|
|
135
|
-
],
|
|
136
|
-
'no-negated-condition': 2,
|
|
137
|
-
'no-process-exit': 0, // suspended by unicorn-x/no-process-exit
|
|
138
|
-
|
|
139
|
-
// The following rules are duplicate with `eslint-plugin-import-x`
|
|
140
|
-
'n/no-extraneous-import': 0,
|
|
141
|
-
'n/no-extraneous-require': 0,
|
|
142
|
-
'n/no-missing-import': 0,
|
|
143
|
-
'n/no-missing-require': 0,
|
|
144
|
-
|
|
145
|
-
'n/no-unsupported-features/es-syntax': 0,
|
|
146
|
-
'n/no-unsupported-features/node-builtins': 0,
|
|
147
|
-
'n/no-unpublished-import': 0,
|
|
148
|
-
'n/no-unpublished-require': 0,
|
|
149
|
-
'prefer-const': [2, { destructuring: 'all' }],
|
|
150
|
-
'prefer-object-spread': 2,
|
|
151
|
-
'simple-import-sort/exports': 2,
|
|
152
|
-
'unicorn-x/catch-error-name': [
|
|
153
|
-
2,
|
|
154
|
-
{
|
|
155
|
-
name: 'error',
|
|
156
|
-
ignore: ['^e(rr)?$'],
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
'unicorn-x/consistent-function-scoping': 0,
|
|
160
|
-
'unicorn-x/filename-case': [
|
|
161
|
-
2,
|
|
162
|
-
{
|
|
163
|
-
cases: {
|
|
164
|
-
kebabCase: true,
|
|
165
|
-
pascalCase: true,
|
|
166
|
-
},
|
|
167
|
-
// ignore UPPER_CASE markdown or yaml filenames
|
|
168
|
-
ignore: [/^[A-Z](([\dA-Z]+_)*[\dA-Z]+)?\.(mdx?|ya?ml)$/],
|
|
169
|
-
},
|
|
170
|
-
],
|
|
171
|
-
'unicorn-x/no-array-reduce': 0,
|
|
172
|
-
'unicorn-x/no-null': 0,
|
|
173
|
-
'unicorn-x/no-unreadable-array-destructuring': 0, // conflict with `no-unused-vars`
|
|
174
|
-
'unicorn-x/prefer-module': 0,
|
|
175
|
-
'unicorn-x/prefer-object-from-entries': 0,
|
|
176
|
-
'unicorn-x/prevent-abbreviations': 0,
|
|
177
|
-
'unicorn-x/prefer-export-from': [2, { ignoreUsedVariables: true }],
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
ignores: [
|
|
182
|
-
'**/.dsh',
|
|
183
|
-
'**/.history',
|
|
184
|
-
'**/.type-coverage',
|
|
185
|
-
'**/.vercel',
|
|
186
|
-
'**/.yarn',
|
|
187
|
-
'**/.pnp.*',
|
|
188
|
-
'**/coverage',
|
|
189
|
-
'**/dist',
|
|
190
|
-
'**/lib',
|
|
191
|
-
'**/node_modules',
|
|
192
|
-
'**/CHANGELOG.md',
|
|
193
|
-
'**/yarn.lock',
|
|
194
|
-
'**/package-lock.json',
|
|
195
|
-
'**/pnpm-lock.yaml',
|
|
196
|
-
'**/auto-imports.d.ts',
|
|
197
|
-
'**/*.less',
|
|
198
|
-
'**/*.log',
|
|
199
|
-
'**/*.patch',
|
|
200
|
-
'**/*.sass',
|
|
201
|
-
'**/*.scss',
|
|
202
|
-
'!.github',
|
|
203
|
-
'!.*.{cjs,js,mjs,cts,ts,mts}',
|
|
204
|
-
],
|
|
205
|
-
},
|
|
206
|
-
])
|
package/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { recommended as default } from './recommended.js'
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { recommended as default } from './recommended.js'
|
package/jest.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import jest_ from 'eslint-plugin-jest'
|
|
4
|
-
import globals from 'globals'
|
|
5
|
-
import tseslint from 'typescript-eslint'
|
|
6
|
-
|
|
7
|
-
import { test } from './test.js'
|
|
8
|
-
|
|
9
|
-
export const jest = tseslint.config({
|
|
10
|
-
name: '@1stg/jest',
|
|
11
|
-
files: ['**/*.{spec,test}.{js,jsx,ts,tsx}'],
|
|
12
|
-
extends: [jest_.configs['flat/recommended']],
|
|
13
|
-
languageOptions: {
|
|
14
|
-
globals: globals.jest,
|
|
15
|
-
},
|
|
16
|
-
rules: test.rules,
|
|
17
|
-
})
|
package/js-base.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
/** @import { TSESLint } from '@typescript-eslint/utils' */
|
|
4
|
-
|
|
5
|
-
import { tryFile, tryPkg, tryRequirePkg } from '@pkgr/utils'
|
|
6
|
-
|
|
7
|
-
/** @type {string | undefined} */
|
|
8
|
-
let configFile
|
|
9
|
-
|
|
10
|
-
export const isBabelAvailable =
|
|
11
|
-
tryPkg('@babel/eslint-parser') && tryPkg('@babel/eslint-plugin')
|
|
12
|
-
|
|
13
|
-
/** @satisfies {TSESLint.FlatConfig.Config} */
|
|
14
|
-
export const jsBase = {
|
|
15
|
-
name: '@1stg/js-base',
|
|
16
|
-
files: ['**/*.{cjs,mjs,js,jsx}'],
|
|
17
|
-
languageOptions: isBabelAvailable
|
|
18
|
-
? {
|
|
19
|
-
parser: tryRequirePkg('@babel/eslint-parser', true),
|
|
20
|
-
// eslint-disable-next-line no-cond-assign, sonarjs/no-nested-assignment
|
|
21
|
-
parserOptions: (configFile =
|
|
22
|
-
tryFile('babel.config.js') ||
|
|
23
|
-
tryFile('.babelrc.js') ||
|
|
24
|
-
tryPkg('@1stg/babel-preset/config'))
|
|
25
|
-
? { babelOptions: { configFile } }
|
|
26
|
-
: { requireConfigFile: false },
|
|
27
|
-
}
|
|
28
|
-
: {},
|
|
29
|
-
plugins: /** @type {TSESLint.FlatConfig.Plugins} */ (
|
|
30
|
-
isBabelAvailable
|
|
31
|
-
? {
|
|
32
|
-
'@babel': /** @type {Omit<TSESLint.FlatConfig.Plugin, 'configs'>} */ (
|
|
33
|
-
tryRequirePkg('@babel/eslint-plugin', true)
|
|
34
|
-
),
|
|
35
|
-
}
|
|
36
|
-
: {}
|
|
37
|
-
),
|
|
38
|
-
rules: {
|
|
39
|
-
camelcase: [2, { properties: 'never', ignoreDestructuring: true }],
|
|
40
|
-
...(isBabelAvailable && {
|
|
41
|
-
'new-cap': 0,
|
|
42
|
-
'no-unused-expressions': 0,
|
|
43
|
-
'@babel/new-cap': 2,
|
|
44
|
-
'@babel/no-unused-expressions': 2,
|
|
45
|
-
}),
|
|
46
|
-
},
|
|
47
|
-
}
|
package/js.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import jsdoc from 'eslint-plugin-jsdoc'
|
|
4
|
-
import tseslint from 'typescript-eslint'
|
|
5
|
-
|
|
6
|
-
import { isTsAvailable } from './_util.js'
|
|
7
|
-
import { jsBase } from './js-base.js'
|
|
8
|
-
|
|
9
|
-
const jsdocConfig = jsdoc.configs['flat/recommended']
|
|
10
|
-
|
|
11
|
-
export const js = tseslint.config({
|
|
12
|
-
...jsBase,
|
|
13
|
-
name: '@1stg/js',
|
|
14
|
-
extends: [jsdocConfig],
|
|
15
|
-
rules: {
|
|
16
|
-
...jsBase.rules,
|
|
17
|
-
'jsdoc/require-jsdoc': 0,
|
|
18
|
-
'jsdoc/require-param-description': 0,
|
|
19
|
-
'jsdoc/tag-lines': 0, // conflict with `prettier-plugin-jsdoc`
|
|
20
|
-
},
|
|
21
|
-
settings: isTsAvailable ? { jsdoc: { mode: 'typescript' } } : undefined,
|
|
22
|
-
})
|
package/loose.d.ts
DELETED
package/loose.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import tseslint from 'typescript-eslint'
|
|
4
|
-
|
|
5
|
-
import { recommended } from './recommended.js'
|
|
6
|
-
|
|
7
|
-
export const loose = tseslint.config([
|
|
8
|
-
recommended,
|
|
9
|
-
{
|
|
10
|
-
rules: {
|
|
11
|
-
'@angular-eslint/template/no-negated-async': 0,
|
|
12
|
-
'@typescript-eslint/member-ordering': 0,
|
|
13
|
-
'@typescript-eslint/naming-convention': 0,
|
|
14
|
-
'@typescript-eslint/no-explicit-any': 0,
|
|
15
|
-
'@typescript-eslint/no-floating-promises': 0,
|
|
16
|
-
'@typescript-eslint/no-magic-numbers': 0,
|
|
17
|
-
'@typescript-eslint/no-type-alias': 0,
|
|
18
|
-
'@typescript-eslint/no-unnecessary-condition': 0,
|
|
19
|
-
'@typescript-eslint/no-unsafe-assignment': 0,
|
|
20
|
-
'@typescript-eslint/no-unsafe-member-access': 0,
|
|
21
|
-
'@typescript-eslint/no-unsafe-return': 0,
|
|
22
|
-
'@typescript-eslint/prefer-ts-expect-error': 0,
|
|
23
|
-
'@typescript-eslint/restrict-plus-operands': 0,
|
|
24
|
-
'@typescript-eslint/sort-type-union-intersection-members': 0,
|
|
25
|
-
'@typescript-eslint/unbound-method': 0,
|
|
26
|
-
'accessor-pairs': 0,
|
|
27
|
-
'no-magic-numbers': 0,
|
|
28
|
-
'no-negated-condition': 0, // not auto-fixable
|
|
29
|
-
'promise/always-return': 0,
|
|
30
|
-
'promise/catch-or-return': 0,
|
|
31
|
-
'unicorn-x/explicit-length-check': 0,
|
|
32
|
-
'unicorn-x/no-array-for-each': 0,
|
|
33
|
-
'unicorn-x/no-fn-reference-in-iterator': 0,
|
|
34
|
-
'unicorn-x/prefer-number-properties': 0,
|
|
35
|
-
'unicorn-x/prefer-prototype-methods': 0,
|
|
36
|
-
'unicorn-x/prefer-spread': 0,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
])
|
package/overrides.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { TSESLint } from '@typescript-eslint/utils'
|
|
2
|
-
|
|
3
|
-
export const js: TSESLint.FlatConfig.ConfigArray
|
|
4
|
-
export const ts: TSESLint.FlatConfig.ConfigArray
|
|
5
|
-
export const dTs: TSESLint.FlatConfig.Config
|
|
6
|
-
export const react: TSESLint.FlatConfig.ConfigArray
|
|
7
|
-
export const vue: TSESLint.FlatConfig.ConfigArray
|
|
8
|
-
export const angular: TSESLint.FlatConfig.ConfigArray
|
|
9
|
-
export const md: TSESLint.FlatConfig.ConfigArray
|
|
10
|
-
export const mdx: TSESLint.FlatConfig.ConfigArray
|
|
11
|
-
export const test: TSESLint.FlatConfig.Config
|
|
12
|
-
export const tests: TSESLint.FlatConfig.Config
|
|
13
|
-
export const jest: TSESLint.FlatConfig.ConfigArray
|
|
14
|
-
export const script: TSESLint.FlatConfig.Config
|
|
15
|
-
export const scripts: TSESLint.FlatConfig.Config
|
|
16
|
-
export const story: TSESLint.FlatConfig.Config
|
|
17
|
-
export const stories: TSESLint.FlatConfig.Config
|
|
18
|
-
export const config: TSESLint.FlatConfig.Config
|
|
19
|
-
export const configs: TSESLint.FlatConfig.Config
|
|
20
|
-
export const jsonc: TSESLint.FlatConfig.ConfigArray
|
|
21
|
-
export const json5: TSESLint.FlatConfig.ConfigArray
|
|
22
|
-
export const toml: TSESLint.FlatConfig.ConfigArray
|
|
23
|
-
export const yaml: TSESLint.FlatConfig.ConfigArray
|
|
24
|
-
export const yml: TSESLint.FlatConfig.ConfigArray
|
|
25
|
-
export const overrides: TSESLint.FlatConfig.ConfigArray
|
package/overrides.js
DELETED
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
/** @import { TSESLint } from '@typescript-eslint/utils' */
|
|
4
|
-
|
|
5
|
-
import { jsoncFiles, nonJsonRcFiles, preferPrettier } from '@1stg/config'
|
|
6
|
-
import { isPkgAvailable } from '@pkgr/utils'
|
|
7
|
-
import * as eslintMdx from 'eslint-mdx'
|
|
8
|
-
import jsonc_ from 'eslint-plugin-jsonc'
|
|
9
|
-
import * as markup_ from 'eslint-plugin-markup'
|
|
10
|
-
import * as mdx_ from 'eslint-plugin-mdx'
|
|
11
|
-
import toml_ from 'eslint-plugin-toml'
|
|
12
|
-
import yml_ from 'eslint-plugin-yml'
|
|
13
|
-
import tseslint from 'typescript-eslint'
|
|
14
|
-
|
|
15
|
-
import {
|
|
16
|
-
isReactPluginAvailable,
|
|
17
|
-
isTsAvailable,
|
|
18
|
-
magicNumbers,
|
|
19
|
-
nonSourceRules,
|
|
20
|
-
prettierExtends,
|
|
21
|
-
} from './_util.js'
|
|
22
|
-
import { jsBase } from './js-base.js'
|
|
23
|
-
import { js } from './js.js'
|
|
24
|
-
import { test } from './test.js'
|
|
25
|
-
import { resolveSettings, tsBase } from './ts-base.js'
|
|
26
|
-
|
|
27
|
-
export const ts = tseslint.config(
|
|
28
|
-
tsBase,
|
|
29
|
-
{
|
|
30
|
-
name: '@1stg/code-block',
|
|
31
|
-
files: ['**/*.{md,mdx}/**/*.{cts,mts,ts,tsx}'],
|
|
32
|
-
languageOptions: {
|
|
33
|
-
parserOptions: {
|
|
34
|
-
project: null,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: '@1stg/ts',
|
|
40
|
-
files: ['**/*.{cts,mts,ts,tsx}'],
|
|
41
|
-
ignores: [
|
|
42
|
-
'**/*.{md,mdx}/**/*.{cts,mts,ts,tsx}',
|
|
43
|
-
'*.d.{cts,mts,ts}',
|
|
44
|
-
'*.d.*.{cts,mts,ts}',
|
|
45
|
-
],
|
|
46
|
-
extends: [tseslint.configs.recommendedTypeChecked],
|
|
47
|
-
rules: {
|
|
48
|
-
'@typescript-eslint/no-floating-promises': [2, { ignoreVoid: true }],
|
|
49
|
-
'@typescript-eslint/no-magic-numbers': [
|
|
50
|
-
2,
|
|
51
|
-
{
|
|
52
|
-
enforceConst: true,
|
|
53
|
-
ignore: magicNumbers,
|
|
54
|
-
ignoreArrayIndexes: true,
|
|
55
|
-
ignoreEnums: true,
|
|
56
|
-
ignoreNumericLiteralTypes: true,
|
|
57
|
-
ignoreReadonlyClassProperties: true,
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
'@typescript-eslint/no-unnecessary-condition': 2,
|
|
61
|
-
'@typescript-eslint/no-unnecessary-qualifier': 2,
|
|
62
|
-
'@typescript-eslint/no-unnecessary-type-arguments': 2,
|
|
63
|
-
'@typescript-eslint/prefer-optional-chain': 2,
|
|
64
|
-
'@typescript-eslint/prefer-readonly': 2,
|
|
65
|
-
'@typescript-eslint/prefer-reduce-type-parameter': 2,
|
|
66
|
-
'@typescript-eslint/prefer-string-starts-ends-with': 2,
|
|
67
|
-
'@typescript-eslint/require-array-sort-compare': [
|
|
68
|
-
2,
|
|
69
|
-
{ ignoreStringArrays: true },
|
|
70
|
-
],
|
|
71
|
-
'@typescript-eslint/restrict-plus-operands': 2,
|
|
72
|
-
'no-constant-condition': 0,
|
|
73
|
-
'no-magic-numbers': 0,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
files: ['**/*.cts'],
|
|
78
|
-
rules: {
|
|
79
|
-
'@typescript-eslint/no-require-imports': 0,
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
/** @satisfies {TSESLint.FlatConfig.Config} */
|
|
85
|
-
export const dTs = {
|
|
86
|
-
name: '@1stg/d-ts',
|
|
87
|
-
files: ['**/*.d.{cts,mts,ts}', '**/*.d.*.{cts,mts,ts}'],
|
|
88
|
-
rules: {
|
|
89
|
-
'@typescript-eslint/no-explicit-any': 0,
|
|
90
|
-
'@typescript-eslint/no-extraneous-class': 0,
|
|
91
|
-
'@typescript-eslint/no-namespace': 0,
|
|
92
|
-
'@typescript-eslint/no-unused-vars': 0,
|
|
93
|
-
'import-x/no-duplicates': 0,
|
|
94
|
-
'import-x/order': 0,
|
|
95
|
-
},
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export const markup = tseslint.config(
|
|
99
|
-
{
|
|
100
|
-
name: '@1stg/markup-html',
|
|
101
|
-
files: ['**/*.html'],
|
|
102
|
-
extends: [markup_.configs.flatRecommended],
|
|
103
|
-
rules: {
|
|
104
|
-
'prettier/prettier': [preferPrettier ? 0 : 2, { parser: 'html' }],
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
name: '@1stg/markup-pug',
|
|
109
|
-
files: ['**/*.pug'],
|
|
110
|
-
extends: [markup_.configs.flatRecommended, ...prettierExtends],
|
|
111
|
-
},
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
export const md = tseslint.config(
|
|
115
|
-
{
|
|
116
|
-
name: '@1stg/md',
|
|
117
|
-
files: ['**/*.md'],
|
|
118
|
-
extends: [mdx_.configs.flat],
|
|
119
|
-
rules: {
|
|
120
|
-
'prettier/prettier': preferPrettier ? 0 : 2,
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
mdx_.configs.flatCodeBlocks,
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
const react = isReactPluginAvailable ? await import('./react.js') : undefined
|
|
127
|
-
|
|
128
|
-
export const mdx = tseslint.config(
|
|
129
|
-
{
|
|
130
|
-
name: '@1stg/mdx',
|
|
131
|
-
files: ['**/*.mdx'],
|
|
132
|
-
extends: [react?.reactJsx, mdx_.configs.flat].filter(Boolean),
|
|
133
|
-
languageOptions: {
|
|
134
|
-
...jsBase.languageOptions,
|
|
135
|
-
parser: eslintMdx,
|
|
136
|
-
},
|
|
137
|
-
settings: react?.reactJsx
|
|
138
|
-
? { ...react.reactJsx[0].settings, ...resolveSettings }
|
|
139
|
-
: resolveSettings,
|
|
140
|
-
rules: {
|
|
141
|
-
'prettier/prettier': preferPrettier ? 0 : 2,
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
mdx_.configs.flatCodeBlocks,
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
/** @satisfies {TSESLint.FlatConfig.Config} */
|
|
148
|
-
export const script = {
|
|
149
|
-
name: '@1stg/script',
|
|
150
|
-
files: ['**/scripts/**/*'],
|
|
151
|
-
rules: nonSourceRules,
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export const scripts = script
|
|
155
|
-
|
|
156
|
-
/** @satisfies {TSESLint.FlatConfig.Config} */
|
|
157
|
-
export const story = {
|
|
158
|
-
name: '@1stg/story',
|
|
159
|
-
files: ['**/.storybook/**/*', '**/stories/**/*'],
|
|
160
|
-
rules: nonSourceRules,
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export const stories = story
|
|
164
|
-
|
|
165
|
-
/** @satisfies {TSESLint.FlatConfig.Config} */
|
|
166
|
-
export const config = {
|
|
167
|
-
name: '@1stg/config',
|
|
168
|
-
files: ['**/.*.js', '**/*.config.{js,ts}'],
|
|
169
|
-
rules: nonSourceRules,
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export const configs = config
|
|
173
|
-
|
|
174
|
-
export const json = tseslint.config({
|
|
175
|
-
name: '@1stg/json',
|
|
176
|
-
files: ['**/.*rc', '**/*.json'],
|
|
177
|
-
ignores: [...nonJsonRcFiles, ...jsoncFiles],
|
|
178
|
-
extends: [
|
|
179
|
-
jsonc_.configs['flat/recommended-with-json'],
|
|
180
|
-
jsonc_.configs['flat/prettier'],
|
|
181
|
-
],
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
export const jsonc = tseslint.config({
|
|
185
|
-
name: '@1stg/jsonc',
|
|
186
|
-
files: jsoncFiles,
|
|
187
|
-
extends: [
|
|
188
|
-
jsonc_.configs['flat/recommended-with-jsonc'],
|
|
189
|
-
jsonc_.configs['flat/prettier'],
|
|
190
|
-
],
|
|
191
|
-
})
|
|
192
|
-
|
|
193
|
-
export const json5 = tseslint.config({
|
|
194
|
-
name: '@1stg/json5',
|
|
195
|
-
files: ['**/*.json5'],
|
|
196
|
-
extends: [
|
|
197
|
-
jsonc_.configs['flat/recommended-with-json5'],
|
|
198
|
-
jsonc_.configs['flat/prettier'],
|
|
199
|
-
],
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
export const toml = tseslint.config({
|
|
203
|
-
name: '@1stg/toml',
|
|
204
|
-
files: ['**/*.toml'],
|
|
205
|
-
extends: [toml_.configs['flat/recommended']],
|
|
206
|
-
})
|
|
207
|
-
|
|
208
|
-
export const yaml = tseslint.config({
|
|
209
|
-
files: ['**/*.yml', '**/*.yaml'],
|
|
210
|
-
extends: [yml_.configs['flat/recommended'], yml_.configs['flat/prettier']],
|
|
211
|
-
})
|
|
212
|
-
|
|
213
|
-
export const yml = yaml
|
|
214
|
-
|
|
215
|
-
export const overrides = tseslint.config(
|
|
216
|
-
js,
|
|
217
|
-
isTsAvailable ? ts : [],
|
|
218
|
-
react?.react || [],
|
|
219
|
-
// The order matters, the later should to be preferred
|
|
220
|
-
markup,
|
|
221
|
-
isPkgAvailable('eslint-plugin-vue')
|
|
222
|
-
? await import('./vue.js').then(({ vue }) => vue)
|
|
223
|
-
: [],
|
|
224
|
-
isPkgAvailable('angular-eslint')
|
|
225
|
-
? await import('./angular.js').then(({ angular }) => angular)
|
|
226
|
-
: [],
|
|
227
|
-
md,
|
|
228
|
-
mdx,
|
|
229
|
-
isPkgAvailable('eslint-plugin-jest')
|
|
230
|
-
? await import('./jest.js').then(({ jest }) => jest)
|
|
231
|
-
: [],
|
|
232
|
-
isPkgAvailable('@vitest/eslint-plugin')
|
|
233
|
-
? await import('./vitest.js').then(({ vitest }) => vitest)
|
|
234
|
-
: [],
|
|
235
|
-
test,
|
|
236
|
-
scripts,
|
|
237
|
-
stories,
|
|
238
|
-
configs,
|
|
239
|
-
dTs,
|
|
240
|
-
json,
|
|
241
|
-
jsonc,
|
|
242
|
-
json5,
|
|
243
|
-
toml,
|
|
244
|
-
yaml,
|
|
245
|
-
// https://github.com/prettier/eslint-config-prettier#curly
|
|
246
|
-
{
|
|
247
|
-
name: '@1stg/prettier',
|
|
248
|
-
rules: {
|
|
249
|
-
curly: [2, 'all'],
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
)
|
package/react.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import react_ from '@eslint-react/eslint-plugin'
|
|
4
|
-
import { tryRequirePkg } from '@pkgr/utils'
|
|
5
|
-
import tseslint from 'typescript-eslint'
|
|
6
|
-
|
|
7
|
-
import { isTsAvailable, prettierExtends } from './_util.js'
|
|
8
|
-
|
|
9
|
-
export const reactJsx = tseslint.config({
|
|
10
|
-
name: '@1stg/react-jsx',
|
|
11
|
-
extends: [react_.configs.recommended, prettierExtends],
|
|
12
|
-
settings: {
|
|
13
|
-
react: {
|
|
14
|
-
version: 'detect',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
const reactHooks_ = tryRequirePkg('eslint-plugin-react-hooks')
|
|
20
|
-
const reactRefresh = tryRequirePkg('eslint-plugin-react-refresh', true)
|
|
21
|
-
|
|
22
|
-
export const react = tseslint.config(
|
|
23
|
-
{
|
|
24
|
-
name: '@1stg/react',
|
|
25
|
-
files: ['**/*.{js,jsx,tsx}'],
|
|
26
|
-
extends: [reactRefresh?.configs.recommended(), reactJsx].filter(Boolean),
|
|
27
|
-
rules: {
|
|
28
|
-
'@eslint-react/avoid-shorthand-boolean': 2,
|
|
29
|
-
// '@eslint-react/naming-convention/handler-prop': [
|
|
30
|
-
// 2,
|
|
31
|
-
// {
|
|
32
|
-
// eventHandlerPrefix: false,
|
|
33
|
-
// eventHandlerPropPrefix: 'on',
|
|
34
|
-
// },
|
|
35
|
-
// ],
|
|
36
|
-
'sonarjs/function-name': isTsAvailable
|
|
37
|
-
? [2, { format: String.raw`^_?[a-zA-Z][a-zA-Z0-9]*\$?$` }]
|
|
38
|
-
: 0,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name: '@1stg/react-tsx',
|
|
43
|
-
files: ['**/*.tsx'],
|
|
44
|
-
rules: {
|
|
45
|
-
'@eslint-react/display-name': 0,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
reactHooks_
|
|
49
|
-
? {
|
|
50
|
-
name: '@1stg/react-hooks',
|
|
51
|
-
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
52
|
-
plugins: { 'react-hooks': reactHooks_ },
|
|
53
|
-
rules: {
|
|
54
|
-
'react-hooks/rules-of-hooks': 2,
|
|
55
|
-
'react-hooks/exhaustive-deps': 2,
|
|
56
|
-
},
|
|
57
|
-
}
|
|
58
|
-
: [],
|
|
59
|
-
{
|
|
60
|
-
name: '@1stg/react-ts',
|
|
61
|
-
files: ['**/*.{ts,tsx}'],
|
|
62
|
-
rules: {
|
|
63
|
-
'no-restricted-imports': [2, 'prop-types'],
|
|
64
|
-
'@eslint-react/prop-types': 0,
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
)
|
package/recommended.d.ts
DELETED