@ocavue/eslint-config 1.8.0 → 1.10.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 +9 -0
- package/dist/src/react.d.ts.map +1 -1
- package/dist/src/typescript-language-options.d.ts +3 -0
- package/dist/src/typescript-language-options.d.ts.map +1 -0
- package/dist/src/typescript.d.ts.map +1 -1
- package/dist/src/vue.d.ts +2 -0
- package/dist/src/vue.d.ts.map +1 -0
- package/package.json +11 -10
- package/src/imports.js +2 -2
- package/src/react.js +7 -11
- package/src/typescript-language-options.js +14 -0
- package/src/typescript.js +2 -9
- package/src/vue.js +38 -0
package/README.md
CHANGED
|
@@ -37,6 +37,15 @@ import { basic, react } from '@ocavue/eslint-config'
|
|
|
37
37
|
export default [...basic(), ...react()]
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
If you want to use the Vue config, you can do the following:
|
|
41
|
+
|
|
42
|
+
```JS
|
|
43
|
+
// eslint.config.js
|
|
44
|
+
import { basic, vue } from '@ocavue/eslint-config'
|
|
45
|
+
|
|
46
|
+
export default [...basic(), ...vue()]
|
|
47
|
+
```
|
|
48
|
+
|
|
40
49
|
If you want to use the check the code blocks in markdown files, you can do the following:
|
|
41
50
|
|
|
42
51
|
```JS
|
package/dist/src/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/react.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/react.js"],"names":[],"mappings":"AAYA,mGAiCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript-language-options.d.ts","sourceRoot":"","sources":["../../src/typescript-language-options.js"],"names":[],"mappings":"AAIA,oEAAoE;AACpE,wCADW,OAAO,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAS/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/typescript.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/typescript.js"],"names":[],"mappings":"AAYA,wGAqFC;;qBA5FoB,mBAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../../src/vue.js"],"names":[],"mappings":"AAYA,iGAyBC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocavue/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"packageManager": "pnpm@8.15.
|
|
4
|
+
"version": "1.10.0",
|
|
5
|
+
"packageManager": "pnpm@8.15.9",
|
|
6
6
|
"description": "",
|
|
7
7
|
"author": "ocavue <ocavue@gmail.com>",
|
|
8
8
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@eslint-types/typescript-eslint": "^7.5.0",
|
|
35
35
|
"@eslint-types/unicorn": "^52.0.0",
|
|
36
|
-
"@types/eslint": "^8.56.
|
|
36
|
+
"@types/eslint": "^8.56.11",
|
|
37
37
|
"@types/eslint-plugin-markdown": "^2.0.2",
|
|
38
38
|
"eslint-config-prettier": "^9.1.0",
|
|
39
39
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
@@ -41,21 +41,22 @@
|
|
|
41
41
|
"eslint-plugin-deprecation": "^3.0.0",
|
|
42
42
|
"eslint-plugin-import": "^2.29.1",
|
|
43
43
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
44
|
-
"eslint-plugin-markdown": "^5.
|
|
44
|
+
"eslint-plugin-markdown": "^5.1.0",
|
|
45
45
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
46
|
-
"eslint-plugin-react": "^7.
|
|
46
|
+
"eslint-plugin-react": "^7.35.0",
|
|
47
47
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
48
48
|
"eslint-plugin-unicorn": "^54.0.0",
|
|
49
|
+
"eslint-plugin-vue": "^9.27.0",
|
|
49
50
|
"jsonc-eslint-parser": "^2.4.0",
|
|
50
|
-
"typescript-eslint": "^7.
|
|
51
|
+
"typescript-eslint": "^7.17.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
|
-
"@antfu/ni": "^0.
|
|
54
|
+
"@antfu/ni": "^0.22.0",
|
|
54
55
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
55
|
-
"@types/node": "^20.14.
|
|
56
|
+
"@types/node": "^20.14.12",
|
|
56
57
|
"eslint": "^8.57.0",
|
|
57
|
-
"prettier": "^3.3.
|
|
58
|
-
"typescript": "^5.5.
|
|
58
|
+
"prettier": "^3.3.3",
|
|
59
|
+
"typescript": "^5.5.4"
|
|
59
60
|
},
|
|
60
61
|
"renovate": {
|
|
61
62
|
"extends": [
|
package/src/imports.js
CHANGED
|
@@ -20,8 +20,8 @@ export function imports() {
|
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
rules: {
|
|
23
|
-
// External modules must be declared in the package.json
|
|
24
|
-
'import/no-extraneous-dependencies': '
|
|
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
25
|
'import/first': 'warn',
|
|
26
26
|
'import/no-mutable-exports': 'warn',
|
|
27
27
|
'import/no-useless-path-segments': 'warn',
|
package/src/react.js
CHANGED
|
@@ -7,34 +7,30 @@ import reactHooksPlugin from 'eslint-plugin-react-hooks'
|
|
|
7
7
|
|
|
8
8
|
import { GLOB_TS, GLOB_TSX } from './shared.js'
|
|
9
9
|
|
|
10
|
+
/** @type {import('eslint').Linter.FlatConfig} */
|
|
11
|
+
const reactRecommended = reactPlugin.configs.flat.recommended
|
|
12
|
+
|
|
10
13
|
export function react() {
|
|
11
14
|
/** @type {import('eslint').Linter.FlatConfig[]} */
|
|
12
15
|
const config = [
|
|
13
16
|
{
|
|
17
|
+
...reactRecommended,
|
|
18
|
+
name: 'react',
|
|
14
19
|
files: [GLOB_TS, GLOB_TSX],
|
|
15
|
-
plugins: {
|
|
16
|
-
react: reactPlugin,
|
|
17
|
-
},
|
|
18
|
-
languageOptions: {
|
|
19
|
-
parserOptions: {
|
|
20
|
-
ecmaFeatures: {
|
|
21
|
-
jsx: true,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
20
|
settings: {
|
|
26
21
|
react: {
|
|
27
22
|
version: 'detect',
|
|
28
23
|
},
|
|
29
24
|
},
|
|
30
25
|
rules: {
|
|
31
|
-
...
|
|
26
|
+
...reactRecommended.rules,
|
|
32
27
|
'react/prop-types': 'off',
|
|
33
28
|
'react/react-in-jsx-scope': 'off',
|
|
34
29
|
},
|
|
35
30
|
},
|
|
36
31
|
|
|
37
32
|
{
|
|
33
|
+
name: 'react-hooks',
|
|
38
34
|
files: [GLOB_TS, GLOB_TSX],
|
|
39
35
|
plugins: {
|
|
40
36
|
'react-hooks': reactHooksPlugin,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import tseslint from 'typescript-eslint'
|
|
4
|
+
|
|
5
|
+
/** @type {import('eslint').Linter.FlatConfig['languageOptions']} */
|
|
6
|
+
export const typescriptLanguageOptions = {
|
|
7
|
+
// @ts-expect-error: conflict type
|
|
8
|
+
parser: tseslint.parser,
|
|
9
|
+
parserOptions: {
|
|
10
|
+
project: true,
|
|
11
|
+
sourceType: 'module',
|
|
12
|
+
ecmaVersion: 'latest',
|
|
13
|
+
},
|
|
14
|
+
}
|
package/src/typescript.js
CHANGED
|
@@ -6,6 +6,7 @@ import deprecationPlugin from 'eslint-plugin-deprecation'
|
|
|
6
6
|
import tseslint from 'typescript-eslint'
|
|
7
7
|
|
|
8
8
|
import { GLOB_JS, GLOB_JSX, GLOB_TEST, GLOB_TS, GLOB_TSX } from './shared.js'
|
|
9
|
+
import { typescriptLanguageOptions } from './typescript-language-options.js'
|
|
9
10
|
|
|
10
11
|
export { tseslint }
|
|
11
12
|
|
|
@@ -19,15 +20,7 @@ export function typescript() {
|
|
|
19
20
|
{
|
|
20
21
|
name: 'typescript',
|
|
21
22
|
files: [GLOB_TS, GLOB_TSX, GLOB_JS, GLOB_JSX],
|
|
22
|
-
languageOptions:
|
|
23
|
-
// @ts-expect-error: conflict type
|
|
24
|
-
parser: tseslint.parser,
|
|
25
|
-
parserOptions: {
|
|
26
|
-
project: true,
|
|
27
|
-
sourceType: 'module',
|
|
28
|
-
ecmaVersion: 'latest',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
23
|
+
languageOptions: typescriptLanguageOptions,
|
|
31
24
|
plugins: {
|
|
32
25
|
// @ts-expect-error: conflict type
|
|
33
26
|
'@typescript-eslint': tseslint.plugin,
|
package/src/vue.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import prettierConfig from 'eslint-config-prettier'
|
|
4
|
+
// @ts-expect-error no types
|
|
5
|
+
import pluginVue from 'eslint-plugin-vue'
|
|
6
|
+
|
|
7
|
+
import { GLOB_VUE } from './shared.js'
|
|
8
|
+
import { typescriptLanguageOptions } from './typescript-language-options.js'
|
|
9
|
+
|
|
10
|
+
/** @type {import('eslint').Linter.FlatConfig} */
|
|
11
|
+
const vueRecommended = pluginVue.configs['flat/recommended']
|
|
12
|
+
|
|
13
|
+
export function vue() {
|
|
14
|
+
/** @type {import('eslint').Linter.FlatConfig[]} */
|
|
15
|
+
const config = [
|
|
16
|
+
{
|
|
17
|
+
...vueRecommended,
|
|
18
|
+
name: 'vue',
|
|
19
|
+
files: [GLOB_VUE],
|
|
20
|
+
languageOptions: typescriptLanguageOptions,
|
|
21
|
+
rules: {
|
|
22
|
+
...vueRecommended.rules,
|
|
23
|
+
|
|
24
|
+
...Object.fromEntries(
|
|
25
|
+
Object.entries(prettierConfig.rules)
|
|
26
|
+
.filter(([key]) => key.startsWith('vue/'))
|
|
27
|
+
.map(([key, value]) => [key, value]),
|
|
28
|
+
),
|
|
29
|
+
|
|
30
|
+
'vue/multi-word-component-names': 'off',
|
|
31
|
+
'vue/one-component-per-file': 'off',
|
|
32
|
+
'vue/require-prop-types': 'off',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
return config
|
|
38
|
+
}
|