|
1 | | -"use strict" |
| 1 | +'use strict'; |
2 | 2 |
|
3 | 3 | // const version = require("./package.json").version |
4 | 4 |
|
5 | 5 | module.exports = { |
6 | | - parserOptions: { |
7 | | - sourceType: "script", |
8 | | - ecmaVersion: "latest", |
9 | | - project: require.resolve("./tsconfig.json"), |
10 | | - }, |
11 | | - extends: [ |
12 | | - "plugin:@ota-meshi/recommended", |
13 | | - "plugin:@ota-meshi/+node", |
14 | | - "plugin:@ota-meshi/+typescript", |
15 | | - "plugin:@ota-meshi/+eslint-plugin", |
16 | | - "plugin:@ota-meshi/+package-json", |
17 | | - "plugin:@ota-meshi/+json", |
18 | | - "plugin:@ota-meshi/+yaml", |
19 | | - "plugin:@ota-meshi/+md", |
20 | | - "plugin:@ota-meshi/+prettier", |
21 | | - ], |
22 | | - rules: { |
23 | | - "require-jsdoc": "off", |
24 | | - "no-warning-comments": "warn", |
25 | | - "no-lonely-if": "off", |
26 | | - "new-cap": "off", |
27 | | - "no-shadow": "off", |
28 | | - "no-void": ["error", { allowAsStatement: true }], |
29 | | - "prettier/prettier": [ |
30 | | - "error", |
31 | | - {}, |
32 | | - { |
33 | | - usePrettierrc: true, |
34 | | - }, |
35 | | - ], |
36 | | - "n/file-extension-in-import": "off", // It's a plugin bug(?). |
37 | | - // Repo rule |
38 | | - "no-restricted-imports": [ |
39 | | - "error", |
40 | | - { |
41 | | - patterns: [ |
42 | | - { |
43 | | - group: ["/regexpp", "/regexpp/*"], |
44 | | - message: "Please use `@eslint-community/regexpp` instead.", |
45 | | - }, |
46 | | - { |
47 | | - group: ["/eslint-utils", "/eslint-utils/*"], |
48 | | - message: "Please use `@eslint-community/eslint-utils` instead.", |
49 | | - }, |
50 | | - ], |
51 | | - }, |
52 | | - ], |
53 | | - }, |
54 | | - overrides: [ |
55 | | - { |
56 | | - files: ["*.md"], |
57 | | - extends: "plugin:mdx/recommended", |
58 | | - settings: { |
59 | | - "mdx/code-blocks": true, |
60 | | - }, |
61 | | - }, |
62 | | - { |
63 | | - files: ["*.mjs"], |
64 | | - parserOptions: { |
65 | | - sourceType: "module", |
66 | | - }, |
67 | | - }, |
68 | | - { |
69 | | - files: ["*.svelte"], |
70 | | - extends: ["plugin:svelte/base"], |
71 | | - parser: "svelte-eslint-parser", |
72 | | - parserOptions: { |
73 | | - parser: { |
74 | | - ts: "@typescript-eslint/parser", |
75 | | - js: "espree", |
76 | | - }, |
77 | | - }, |
78 | | - }, |
79 | | - { |
80 | | - files: ["*.ts", "*.mts"], |
81 | | - parser: "@typescript-eslint/parser", |
82 | | - parserOptions: { |
83 | | - sourceType: "module", |
84 | | - project: require.resolve("./tsconfig.json"), |
85 | | - }, |
86 | | - rules: { |
87 | | - "@typescript-eslint/naming-convention": [ |
88 | | - "error", |
89 | | - { |
90 | | - selector: "default", |
91 | | - format: ["camelCase"], |
92 | | - leadingUnderscore: "allow", |
93 | | - trailingUnderscore: "allow", |
94 | | - }, |
95 | | - { |
96 | | - selector: "variable", |
97 | | - format: ["camelCase", "UPPER_CASE"], |
98 | | - leadingUnderscore: "allow", |
99 | | - trailingUnderscore: "allow", |
100 | | - }, |
101 | | - { |
102 | | - selector: "typeLike", |
103 | | - format: ["PascalCase"], |
104 | | - }, |
105 | | - { |
106 | | - selector: "property", |
107 | | - format: null, |
108 | | - }, |
109 | | - { |
110 | | - selector: "method", |
111 | | - format: null, |
112 | | - }, |
113 | | - ], |
114 | | - "@typescript-eslint/no-non-null-assertion": "off", |
115 | | - }, |
116 | | - }, |
117 | | - { |
118 | | - files: ["src/**"], |
119 | | - rules: { |
120 | | - "@typescript-eslint/no-restricted-imports": [ |
121 | | - "error", |
122 | | - { |
123 | | - patterns: [ |
124 | | - { |
125 | | - group: ["@typescript-eslint/*"], |
126 | | - message: |
127 | | - "@typescript-eslint is not included in dependencies. Only type-import is allowed.", |
128 | | - allowTypeImports: true, |
129 | | - }, |
130 | | - ], |
131 | | - }, |
132 | | - ], |
133 | | - }, |
134 | | - }, |
135 | | - { |
136 | | - files: ["src/rules/**"], |
137 | | - rules: {}, |
138 | | - }, |
139 | | - { |
140 | | - files: ["tests/**"], |
141 | | - rules: { |
142 | | - "@typescript-eslint/no-misused-promises": "off", |
143 | | - }, |
144 | | - }, |
145 | | - { |
146 | | - files: ["scripts/**/*.ts", "tests/**/*.ts"], |
147 | | - parser: "@typescript-eslint/parser", |
148 | | - parserOptions: { |
149 | | - sourceType: "module", |
150 | | - project: require.resolve("./tsconfig.json"), |
151 | | - }, |
152 | | - rules: { |
153 | | - "no-console": "off", |
154 | | - }, |
155 | | - }, |
156 | | - ], |
157 | | -} |
| 6 | + parserOptions: { |
| 7 | + sourceType: 'script', |
| 8 | + ecmaVersion: 'latest', |
| 9 | + project: require.resolve('./tsconfig.json') |
| 10 | + }, |
| 11 | + extends: [ |
| 12 | + 'plugin:@ota-meshi/recommended', |
| 13 | + 'plugin:@ota-meshi/+node', |
| 14 | + 'plugin:@ota-meshi/+typescript', |
| 15 | + 'plugin:@ota-meshi/+eslint-plugin', |
| 16 | + 'plugin:@ota-meshi/+package-json', |
| 17 | + 'plugin:@ota-meshi/+json', |
| 18 | + 'plugin:@ota-meshi/+yaml', |
| 19 | + 'plugin:@ota-meshi/+md', |
| 20 | + 'plugin:@ota-meshi/+prettier' |
| 21 | + ], |
| 22 | + rules: { |
| 23 | + 'require-jsdoc': 'off', |
| 24 | + 'no-warning-comments': 'warn', |
| 25 | + 'no-lonely-if': 'off', |
| 26 | + 'new-cap': 'off', |
| 27 | + 'no-shadow': 'off', |
| 28 | + 'no-void': ['error', { allowAsStatement: true }], |
| 29 | + 'prettier/prettier': [ |
| 30 | + 'error', |
| 31 | + {}, |
| 32 | + { |
| 33 | + usePrettierrc: true |
| 34 | + } |
| 35 | + ], |
| 36 | + 'n/file-extension-in-import': 'off', // It's a plugin bug(?). |
| 37 | + // Repo rule |
| 38 | + 'no-restricted-imports': [ |
| 39 | + 'error', |
| 40 | + { |
| 41 | + patterns: [ |
| 42 | + { |
| 43 | + group: ['/regexpp', '/regexpp/*'], |
| 44 | + message: 'Please use `@eslint-community/regexpp` instead.' |
| 45 | + }, |
| 46 | + { |
| 47 | + group: ['/eslint-utils', '/eslint-utils/*'], |
| 48 | + message: 'Please use `@eslint-community/eslint-utils` instead.' |
| 49 | + } |
| 50 | + ] |
| 51 | + } |
| 52 | + ] |
| 53 | + }, |
| 54 | + overrides: [ |
| 55 | + { |
| 56 | + files: ['*.md'], |
| 57 | + extends: 'plugin:mdx/recommended', |
| 58 | + settings: { |
| 59 | + 'mdx/code-blocks': true |
| 60 | + } |
| 61 | + }, |
| 62 | + { |
| 63 | + files: ['*.mjs'], |
| 64 | + parserOptions: { |
| 65 | + sourceType: 'module' |
| 66 | + } |
| 67 | + }, |
| 68 | + { |
| 69 | + files: ['*.svelte'], |
| 70 | + extends: ['plugin:svelte/base'], |
| 71 | + parser: 'svelte-eslint-parser', |
| 72 | + parserOptions: { |
| 73 | + parser: { |
| 74 | + ts: '@typescript-eslint/parser', |
| 75 | + js: 'espree' |
| 76 | + } |
| 77 | + } |
| 78 | + }, |
| 79 | + { |
| 80 | + files: ['*.ts', '*.mts'], |
| 81 | + parser: '@typescript-eslint/parser', |
| 82 | + parserOptions: { |
| 83 | + sourceType: 'module', |
| 84 | + project: require.resolve('./tsconfig.json') |
| 85 | + }, |
| 86 | + rules: { |
| 87 | + '@typescript-eslint/naming-convention': [ |
| 88 | + 'error', |
| 89 | + { |
| 90 | + selector: 'default', |
| 91 | + format: ['camelCase'], |
| 92 | + leadingUnderscore: 'allow', |
| 93 | + trailingUnderscore: 'allow' |
| 94 | + }, |
| 95 | + { |
| 96 | + selector: 'variable', |
| 97 | + format: ['camelCase', 'UPPER_CASE'], |
| 98 | + leadingUnderscore: 'allow', |
| 99 | + trailingUnderscore: 'allow' |
| 100 | + }, |
| 101 | + { |
| 102 | + selector: 'typeLike', |
| 103 | + format: ['PascalCase'] |
| 104 | + }, |
| 105 | + { |
| 106 | + selector: 'property', |
| 107 | + format: null |
| 108 | + }, |
| 109 | + { |
| 110 | + selector: 'method', |
| 111 | + format: null |
| 112 | + } |
| 113 | + ], |
| 114 | + '@typescript-eslint/no-non-null-assertion': 'off' |
| 115 | + } |
| 116 | + }, |
| 117 | + { |
| 118 | + files: ['src/**'], |
| 119 | + rules: { |
| 120 | + '@typescript-eslint/no-restricted-imports': [ |
| 121 | + 'error', |
| 122 | + { |
| 123 | + patterns: [ |
| 124 | + { |
| 125 | + group: ['@typescript-eslint/*'], |
| 126 | + message: |
| 127 | + '@typescript-eslint is not included in dependencies. Only type-import is allowed.', |
| 128 | + allowTypeImports: true |
| 129 | + } |
| 130 | + ] |
| 131 | + } |
| 132 | + ] |
| 133 | + } |
| 134 | + }, |
| 135 | + { |
| 136 | + files: ['src/rules/**'], |
| 137 | + rules: {} |
| 138 | + }, |
| 139 | + { |
| 140 | + files: ['tests/**'], |
| 141 | + rules: { |
| 142 | + '@typescript-eslint/no-misused-promises': 'off' |
| 143 | + } |
| 144 | + }, |
| 145 | + { |
| 146 | + files: ['scripts/**/*.ts', 'tests/**/*.ts'], |
| 147 | + parser: '@typescript-eslint/parser', |
| 148 | + parserOptions: { |
| 149 | + sourceType: 'module', |
| 150 | + project: require.resolve('./tsconfig.json') |
| 151 | + }, |
| 152 | + rules: { |
| 153 | + 'no-console': 'off' |
| 154 | + } |
| 155 | + } |
| 156 | + ] |
| 157 | +}; |
0 commit comments