@lntvow/eslint-config 9.20.3 → 9.21.1
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 +43 -0
- package/dist/index.cjs +20 -14
- package/dist/index.d.cts +199 -68
- package/dist/index.d.mts +199 -68
- package/dist/index.d.ts +199 -68
- package/dist/index.mjs +20 -14
- package/package.json +12 -9
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @lntvow/eslint-config
|
|
2
|
+
|
|
3
|
+
## Usage
|
|
4
|
+
|
|
5
|
+
install @lntvow/eslint-config
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm install -D @lntvow/eslint-config
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
create `eslint.config.js` in your project root
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
// eslint.config.js
|
|
15
|
+
import { lntvow } from '@lntvow/eslint-config'
|
|
16
|
+
|
|
17
|
+
export default lntvow()
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Plugins
|
|
21
|
+
|
|
22
|
+
Since flat config requires us to explicitly provide the plugin names (instead of the mandatory convention from npm package name), we renamed some plugins to make the overall scope more consistent and easier to write.
|
|
23
|
+
|
|
24
|
+
| New Prefix | Original Prefix | Source Plugin |
|
|
25
|
+
| ---------- | ---------------------- | ------------------------------------------------------------------------------------------ |
|
|
26
|
+
| `ts/*` | `@typescript-eslint/*` | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) |
|
|
27
|
+
| `vue/*` | `@vue/*` | [eslint-plugin-vue](https://github.com/vuejs/eslint-plugin-vue) |
|
|
28
|
+
| `import/*` | `import-x/*` | [eslint-plugin-import-x](https://github.com/un-es/eslint-plugin-import-x) |
|
|
29
|
+
| `style/*` | `@stylistic/*` | [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic) |
|
|
30
|
+
|
|
31
|
+
## Tips
|
|
32
|
+
|
|
33
|
+
- If the project is installed via `npm` or `yarn`, you can skip this tip.
|
|
34
|
+
- If you do not want to manually install `eslint` and other dependencies, and choose to use `pnpm` for installation, please note the following points:
|
|
35
|
+
- Due to the symbolic link feature of `pnpm` conflicting with the functionality of `eslint`, some packages must be hoisted to the root of `node_modules`.
|
|
36
|
+
- Create a `.npmrc` file in the root directory of the project and write `shamefully-hoist=true`. This command is used to hoist dependencies to the root of `node_modules`, then you can reinstall the dependencies.
|
|
37
|
+
- Alternatively, you can also choose to manually install `eslint` and other dependencies to the root of `node_modules`.
|
|
38
|
+
|
|
39
|
+
## Todo
|
|
40
|
+
|
|
41
|
+
- `.gitignore` 功能异常
|
|
42
|
+
|
|
43
|
+
## 注意事项
|
package/dist/index.cjs
CHANGED
|
@@ -233,20 +233,23 @@ async function ignores(ignoresList = []) {
|
|
|
233
233
|
|
|
234
234
|
async function imports(options = {}) {
|
|
235
235
|
return [
|
|
236
|
-
// pluginImport.flatConfigs.typescript,
|
|
237
236
|
{
|
|
238
237
|
name: "lntvow/imports/rules",
|
|
239
238
|
plugins: {
|
|
240
239
|
import: pluginImport__default
|
|
241
240
|
},
|
|
242
241
|
rules: {
|
|
243
|
-
//
|
|
244
|
-
//
|
|
245
|
-
//
|
|
246
|
-
//
|
|
247
|
-
//
|
|
248
|
-
//
|
|
249
|
-
//
|
|
242
|
+
// Helpful warnings
|
|
243
|
+
// 禁止重复导入
|
|
244
|
+
// 'import/export': 'error',
|
|
245
|
+
// 禁止导入废弃的内容
|
|
246
|
+
// 'import/no-deprecated': 'warn',
|
|
247
|
+
// 禁止空的导入
|
|
248
|
+
// 'import/no-empty-named-blocks': 'error',
|
|
249
|
+
// 幽灵依赖
|
|
250
|
+
// 'import/no-extraneous-dependencies': 'error',
|
|
251
|
+
// 禁止使用var或let进行可变导出
|
|
252
|
+
// 'import/no-mutable-exports': 'error',
|
|
250
253
|
// // 'import/no-named-as-default': 'error',
|
|
251
254
|
// // 'import/no-named-as-default-member': 'error',
|
|
252
255
|
// // 'import/no-unused-modules': 'error',
|
|
@@ -327,6 +330,9 @@ async function javascript(options = {}) {
|
|
|
327
330
|
// ...globals.es2021,
|
|
328
331
|
// ...globals.node,
|
|
329
332
|
}
|
|
333
|
+
},
|
|
334
|
+
linterOptions: {
|
|
335
|
+
reportUnusedDisableDirectives: "warn"
|
|
330
336
|
}
|
|
331
337
|
},
|
|
332
338
|
{
|
|
@@ -506,7 +512,7 @@ const notInRecommendedRules = {
|
|
|
506
512
|
// 禁用 Object 的构造函数
|
|
507
513
|
"no-octal-escape": "error",
|
|
508
514
|
// 禁止在字符串中使用八进制转义序列
|
|
509
|
-
"no-param-reassign": "
|
|
515
|
+
"no-param-reassign": "off",
|
|
510
516
|
// 禁止对 function 的参数进行重新赋值
|
|
511
517
|
"no-plusplus": "off",
|
|
512
518
|
// 禁用一元操作符 ++ 和 --
|
|
@@ -740,16 +746,16 @@ async function typescript(options = {}) {
|
|
|
740
746
|
name: "lntvow/typescript/setup",
|
|
741
747
|
plugins: {
|
|
742
748
|
ts: pluginTs__default
|
|
743
|
-
}
|
|
749
|
+
}
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
name: "lntvow/typescript/rules",
|
|
744
753
|
languageOptions: {
|
|
745
754
|
parser: parserTs__default,
|
|
746
755
|
parserOptions: {
|
|
747
756
|
sourceType: "module"
|
|
748
757
|
}
|
|
749
|
-
}
|
|
750
|
-
},
|
|
751
|
-
{
|
|
752
|
-
name: "lntvow/typescript/rules",
|
|
758
|
+
},
|
|
753
759
|
files,
|
|
754
760
|
rules: {
|
|
755
761
|
...renameRules(pluginTs__default.configs["eslint-recommended"].overrides[0].rules, {
|