@ocavue/eslint-config 2.16.0 → 2.17.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/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 +5 -0
- package/dist/imports.d.ts +2 -0
- package/dist/imports.js +49 -0
- package/dist/index.d.ts +6 -7
- package/dist/index.js +6 -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/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/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 +17 -20
- 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/dist/vue.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import prettierConfig from 'eslint-config-prettier';
|
|
2
|
+
import vuePlugin from 'eslint-plugin-vue';
|
|
3
|
+
import globals from 'globals';
|
|
4
|
+
import tseslint from 'typescript-eslint';
|
|
5
|
+
import { GLOB_VUE } from './shared.js';
|
|
6
|
+
export function vue() {
|
|
7
|
+
return [
|
|
8
|
+
...vuePlugin.configs['flat/recommended'],
|
|
9
|
+
{
|
|
10
|
+
name: 'vue:language-options',
|
|
11
|
+
files: [GLOB_VUE],
|
|
12
|
+
languageOptions: {
|
|
13
|
+
ecmaVersion: 'latest',
|
|
14
|
+
sourceType: 'module',
|
|
15
|
+
globals: globals.browser,
|
|
16
|
+
parserOptions: {
|
|
17
|
+
parser: tseslint.parser,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'vue:rules-override',
|
|
23
|
+
rules: {
|
|
24
|
+
...Object.fromEntries(Object.entries(prettierConfig.rules)
|
|
25
|
+
.filter(([key]) => key.startsWith('vue/'))
|
|
26
|
+
.map(([key, value]) => [key, value])),
|
|
27
|
+
'vue/multi-word-component-names': 'off',
|
|
28
|
+
'vue/one-component-per-file': 'off',
|
|
29
|
+
'vue/require-prop-types': 'off',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocavue/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
5
|
-
"packageManager": "pnpm@9.15.9",
|
|
4
|
+
"version": "2.17.0",
|
|
6
5
|
"description": "",
|
|
7
6
|
"author": "ocavue <ocavue@gmail.com>",
|
|
8
7
|
"license": "MIT",
|
|
@@ -22,26 +21,17 @@
|
|
|
22
21
|
"vue"
|
|
23
22
|
],
|
|
24
23
|
"sideEffects": false,
|
|
25
|
-
"main": "./index.js",
|
|
26
|
-
"module": "./index.js",
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"module": "./dist/index.js",
|
|
27
26
|
"types": "./dist/index.d.ts",
|
|
28
27
|
"files": [
|
|
29
|
-
"index.js",
|
|
30
|
-
"src",
|
|
31
28
|
"dist"
|
|
32
29
|
],
|
|
33
|
-
"scripts": {
|
|
34
|
-
"build": "tsc",
|
|
35
|
-
"check": "prettier --check .",
|
|
36
|
-
"fix": "eslint --fix . && prettier --write .",
|
|
37
|
-
"lint": "eslint .",
|
|
38
|
-
"prepublishOnly": "nr build"
|
|
39
|
-
},
|
|
40
30
|
"dependencies": {
|
|
41
31
|
"@eslint/js": "^9.26.0",
|
|
42
32
|
"@eslint/markdown": "^6.4.0",
|
|
43
33
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
44
|
-
"eslint-config-prettier": "^10.1.
|
|
34
|
+
"eslint-config-prettier": "^10.1.3",
|
|
45
35
|
"eslint-import-resolver-typescript": "^4.3.4",
|
|
46
36
|
"eslint-plugin-antfu": "^3.1.1",
|
|
47
37
|
"eslint-plugin-import-x": "^4.11.0",
|
|
@@ -49,18 +39,19 @@
|
|
|
49
39
|
"eslint-plugin-package-json": "^0.31.0",
|
|
50
40
|
"eslint-plugin-react": "^7.37.5",
|
|
51
41
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
52
|
-
"eslint-plugin-unicorn": "^
|
|
42
|
+
"eslint-plugin-unicorn": "^59.0.1",
|
|
53
43
|
"eslint-plugin-vue": "^10.1.0",
|
|
54
|
-
"globals": "^16.
|
|
55
|
-
"typescript-eslint": "^8.
|
|
44
|
+
"globals": "^16.1.0",
|
|
45
|
+
"typescript-eslint": "^8.32.0",
|
|
56
46
|
"vue-eslint-parser": "^10.1.3"
|
|
57
47
|
},
|
|
58
48
|
"devDependencies": {
|
|
59
|
-
"@
|
|
49
|
+
"@ocavue/tsconfig": "^0.3.7",
|
|
60
50
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
61
51
|
"@types/node": "^20.17.9",
|
|
62
|
-
"@typescript-eslint/utils": "^8.
|
|
52
|
+
"@typescript-eslint/utils": "^8.32.0",
|
|
63
53
|
"eslint": "^9.26.0",
|
|
54
|
+
"jiti": "^2.4.2",
|
|
64
55
|
"pkg-pr-new": "^0.0.43",
|
|
65
56
|
"prettier": "^3.5.3",
|
|
66
57
|
"typescript": "^5.8.3"
|
|
@@ -69,5 +60,11 @@
|
|
|
69
60
|
"extends": [
|
|
70
61
|
"github>ocavue/config-renovate"
|
|
71
62
|
]
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsc -b",
|
|
66
|
+
"check": "prettier --check .",
|
|
67
|
+
"fix": "eslint --fix . && prettier --write .",
|
|
68
|
+
"lint": "eslint ."
|
|
72
69
|
}
|
|
73
|
-
}
|
|
70
|
+
}
|
package/dist/eslint.config.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.config.d.ts","sourceRoot":"","sources":["../eslint.config.js"],"names":[],"mappings":""}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":""}
|
package/dist/src/antfu.d.ts
DELETED
package/dist/src/antfu.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"antfu.d.ts","sourceRoot":"","sources":["../../src/antfu.js"],"names":[],"mappings":"AAEA,+FAgBC"}
|
package/dist/src/basic.d.ts
DELETED
package/dist/src/basic.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/basic.js"],"names":[],"mappings":"AAWA,+FAcC"}
|
package/dist/src/ignores.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ignores.d.ts","sourceRoot":"","sources":["../../src/ignores.js"],"names":[],"mappings":"AAIA,iGAKC"}
|
package/dist/src/imports.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../src/imports.js"],"names":[],"mappings":"AAIA,iGAkDC"}
|
package/dist/src/markdown.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/markdown.js"],"names":[],"mappings":"AAMA,kGAwDC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-only-tests.d.ts","sourceRoot":"","sources":["../../src/no-only-tests.js"],"names":[],"mappings":"AAIA,qGAeC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../../src/package-json.js"],"names":[],"mappings":"AAIA;;GAEG;AACH,qGAsEC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prettier.d.ts","sourceRoot":"","sources":["../../src/prettier.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,kGAYC"}
|
package/dist/src/react.d.ts
DELETED
package/dist/src/react.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/react.js"],"names":[],"mappings":"AAWA,+FAiCC"}
|
package/dist/src/shared.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export const GLOB_SRC_EXT: "?([cm])[jt]s?(x)";
|
|
2
|
-
export const GLOB_SRC: "**/*.?([cm])[jt]s?(x)";
|
|
3
|
-
export const GLOB_JS: "**/*.?([cm])js";
|
|
4
|
-
export const GLOB_JSX: "**/*.?([cm])jsx";
|
|
5
|
-
export const GLOB_TS: "**/*.?([cm])ts";
|
|
6
|
-
export const GLOB_TSX: "**/*.?([cm])tsx";
|
|
7
|
-
export const GLOB_TEST: "**/*.(spec|test).?([cm])[jt]s?(x)";
|
|
8
|
-
export const GLOB_STYLE: "**/*.{c,le,sc}ss";
|
|
9
|
-
export const GLOB_CSS: "**/*.css";
|
|
10
|
-
export const GLOB_LESS: "**/*.less";
|
|
11
|
-
export const GLOB_SCSS: "**/*.scss";
|
|
12
|
-
export const GLOB_JSON: "**/*.json";
|
|
13
|
-
export const GLOB_JSON5: "**/*.json5";
|
|
14
|
-
export const GLOB_JSONC: "**/*.jsonc";
|
|
15
|
-
export const GLOB_MARKDOWN: "**/*.md";
|
|
16
|
-
export const GLOB_VUE: "**/*.vue";
|
|
17
|
-
export const GLOB_YAML: "**/*.y?(a)ml";
|
|
18
|
-
export const GLOB_HTML: "**/*.htm?(l)";
|
|
19
|
-
export const GLOB_ALL_SRC: readonly ["**/*.?([cm])[jt]s?(x)", "**/*.{c,le,sc}ss", "**/*.json", "**/*.json5", "**/*.md", "**/*.vue", "**/*.y?(a)ml", "**/*.htm?(l)"];
|
|
20
|
-
export const GLOB_NODE_MODULES: "**/node_modules";
|
|
21
|
-
export const GLOB_LOCKFILE: readonly ["**/package-lock.json", "**/yarn.lock", "**/pnpm-lock.yaml"];
|
|
22
|
-
export const GLOB_EXCLUDE: readonly ["**/node_modules", "**/package-lock.json", "**/yarn.lock", "**/pnpm-lock.yaml", "**/fixtures", "**/.changeset", "**/CHANGELOG*.md", "**/*.min.*", "**/LICENSE*", "**/__snapshots__", "**/.tsup"];
|
|
23
|
-
export const EXTENSIONS: string[];
|
|
24
|
-
//# sourceMappingURL=shared.d.ts.map
|
package/dist/src/shared.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/shared.js"],"names":[],"mappings":"AAEA,2BAA4B,kBAAkB,CAAA;AAC9C,uBAAwB,uBAAuB,CAAA;AAE/C,sBAAuB,gBAAgB,CAAA;AACvC,uBAAwB,iBAAiB,CAAA;AAEzC,sBAAuB,gBAAgB,CAAA;AACvC,uBAAwB,iBAAiB,CAAA;AAEzC,wBAAyB,mCAAmC,CAAA;AAE5D,yBAA0B,kBAAkB,CAAA;AAC5C,uBAAwB,UAAU,CAAA;AAClC,wBAAyB,WAAW,CAAA;AACpC,wBAAyB,WAAW,CAAA;AAEpC,wBAAyB,WAAW,CAAA;AACpC,yBAA0B,YAAY,CAAA;AACtC,yBAA0B,YAAY,CAAA;AAEtC,4BAA6B,SAAS,CAAA;AACtC,uBAAwB,UAAU,CAAA;AAClC,wBAAyB,cAAc,CAAA;AACvC,wBAAyB,cAAc,CAAA;AAEvC,oKASE;AAEF,gCAAuD,iBAAiB,CAAC;AACzE,mGAIE;AACF,sOAWE;AAEF,kCAGsC"}
|
package/dist/src/typescript.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/typescript.js"],"names":[],"mappings":"AASA,oGAsHC;;qBA5HoB,mBAAmB"}
|
package/dist/src/unicorn.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unicorn.d.ts","sourceRoot":"","sources":["../../src/unicorn.js"],"names":[],"mappings":"AAIA,iGAsEC"}
|
package/dist/src/vue.d.ts
DELETED
package/dist/src/vue.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../../src/vue.js"],"names":[],"mappings":"AAYA,6FAiCC"}
|
package/index.js
DELETED
package/src/antfu.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import antfuPlugin from 'eslint-plugin-antfu'
|
|
2
|
-
|
|
3
|
-
export function antfu() {
|
|
4
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
5
|
-
const config = [
|
|
6
|
-
{
|
|
7
|
-
name: 'antfu',
|
|
8
|
-
plugins: {
|
|
9
|
-
antfu: antfuPlugin,
|
|
10
|
-
},
|
|
11
|
-
rules: {
|
|
12
|
-
'antfu/import-dedupe': 'error',
|
|
13
|
-
'antfu/top-level-function': 'error',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
return config
|
|
19
|
-
}
|
package/src/basic.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import { antfu } from './antfu.js'
|
|
4
|
-
import { ignores } from './ignores.js'
|
|
5
|
-
import { imports } from './imports.js'
|
|
6
|
-
import { noOnlyTests } from './no-only-tests.js'
|
|
7
|
-
import { packageJson } from './package-json.js'
|
|
8
|
-
import { prettier } from './prettier.js'
|
|
9
|
-
import { typescript } from './typescript.js'
|
|
10
|
-
import { unicorn } from './unicorn.js'
|
|
11
|
-
|
|
12
|
-
export function basic() {
|
|
13
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
14
|
-
const config = [
|
|
15
|
-
...ignores(),
|
|
16
|
-
...typescript(),
|
|
17
|
-
...imports(),
|
|
18
|
-
...packageJson(),
|
|
19
|
-
...unicorn(),
|
|
20
|
-
...antfu(),
|
|
21
|
-
...noOnlyTests(),
|
|
22
|
-
...prettier(),
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
return config
|
|
26
|
-
}
|
package/src/ignores.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import gitignore from 'eslint-config-flat-gitignore'
|
|
2
|
-
|
|
3
|
-
import { GLOB_EXCLUDE } from './shared.js'
|
|
4
|
-
|
|
5
|
-
export function ignores() {
|
|
6
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
7
|
-
const config = [{ ignores: [...GLOB_EXCLUDE] }, gitignore()]
|
|
8
|
-
|
|
9
|
-
return config
|
|
10
|
-
}
|
package/src/imports.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import * as importPlugin from 'eslint-plugin-import-x'
|
|
4
|
-
|
|
5
|
-
export function imports() {
|
|
6
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
7
|
-
const config = [
|
|
8
|
-
{
|
|
9
|
-
name: 'import',
|
|
10
|
-
plugins: {
|
|
11
|
-
// @ts-expect-error incorrect type
|
|
12
|
-
import: importPlugin,
|
|
13
|
-
},
|
|
14
|
-
settings: {
|
|
15
|
-
'import-x/resolver': {
|
|
16
|
-
// You will also need to install and configure the TypeScript resolver
|
|
17
|
-
// See also https://github.com/import-js/eslint-import-resolver-typescript#configuration
|
|
18
|
-
typescript: true,
|
|
19
|
-
node: true,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
rules: {
|
|
23
|
-
// External modules must be declared in the package.json. Only enforced in CI.
|
|
24
|
-
'import/no-extraneous-dependencies': process.env.CI ? 'error' : 'off',
|
|
25
|
-
'import/first': 'warn',
|
|
26
|
-
'import/no-mutable-exports': 'warn',
|
|
27
|
-
'import/no-useless-path-segments': 'warn',
|
|
28
|
-
'import/newline-after-import': 'warn',
|
|
29
|
-
// Disable `no-duplicates` because of the following bug
|
|
30
|
-
// https://github.com/un-ts/eslint-plugin-import-x/issues/167
|
|
31
|
-
// 'import/no-duplicates': [
|
|
32
|
-
// 'warn',
|
|
33
|
-
// { 'prefer-inline': true },
|
|
34
|
-
// ],
|
|
35
|
-
'import/order': [
|
|
36
|
-
'warn',
|
|
37
|
-
{
|
|
38
|
-
'newlines-between': 'always',
|
|
39
|
-
alphabetize: { order: 'asc' },
|
|
40
|
-
groups: [
|
|
41
|
-
'builtin',
|
|
42
|
-
'external',
|
|
43
|
-
'internal',
|
|
44
|
-
'parent',
|
|
45
|
-
'sibling',
|
|
46
|
-
'index',
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
]
|
|
53
|
-
|
|
54
|
-
return config
|
|
55
|
-
}
|
package/src/markdown.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import markdownPlugin from '@eslint/markdown'
|
|
4
|
-
|
|
5
|
-
import { GLOB_MARKDOWN, GLOB_SRC, GLOB_VUE } from './shared.js'
|
|
6
|
-
|
|
7
|
-
export function markdown() {
|
|
8
|
-
const recommended = markdownPlugin.configs?.processor
|
|
9
|
-
|
|
10
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
11
|
-
const recommendedConfig = Array.isArray(recommended)
|
|
12
|
-
? recommended
|
|
13
|
-
: (() => {
|
|
14
|
-
throw new Error(
|
|
15
|
-
'[@ocavue/eslint-config] markdown recommended is not an array',
|
|
16
|
-
)
|
|
17
|
-
})()
|
|
18
|
-
|
|
19
|
-
/** @type {import('eslint').Linter.Config[]} */
|
|
20
|
-
const config = [
|
|
21
|
-
...recommendedConfig,
|
|
22
|
-
|
|
23
|
-
{
|
|
24
|
-
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
25
|
-
languageOptions: {
|
|
26
|
-
parserOptions: {
|
|
27
|
-
projectService: null,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
rules: {
|
|
31
|
-
// Disable type-aware TypeScript rules, because the code blocks are not
|
|
32
|
-
// part of a compilable `tsconfig.json` project.
|
|
33
|
-
'@typescript-eslint/no-redeclare': 'off',
|
|
34
|
-
'@typescript-eslint/no-unused-vars': 'off',
|
|
35
|
-
'@typescript-eslint/no-use-before-define': 'off',
|
|
36
|
-
'@typescript-eslint/no-var-requires': 'off',
|
|
37
|
-
'@typescript-eslint/restrict-plus-operands': 'off',
|
|
38
|
-
'@typescript-eslint/no-unsafe-call': 'off',
|
|
39
|
-
'@typescript-eslint/no-unsafe-return': 'off',
|
|
40
|
-
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
41
|
-
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
42
|
-
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
43
|
-
'@typescript-eslint/no-floating-promises': 'off',
|
|
44
|
-
'@typescript-eslint/no-misused-promises': 'off',
|
|
45
|
-
'@typescript-eslint/await-thenable': 'off',
|
|
46
|
-
'@typescript-eslint/unbound-method': 'off',
|
|
47
|
-
'@typescript-eslint/require-await': 'off',
|
|
48
|
-
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
|
|
49
|
-
|
|
50
|
-
// Disable some import rules because they are not working well with
|
|
51
|
-
// twoslash ---cut--- imports.
|
|
52
|
-
'import/first': 'off',
|
|
53
|
-
'import/order': 'off',
|
|
54
|
-
|
|
55
|
-
'no-alert': 'off',
|
|
56
|
-
'no-console': 'off',
|
|
57
|
-
'no-restricted-imports': 'off',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
]
|
|
61
|
-
|
|
62
|
-
return config
|
|
63
|
-
}
|
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])
|