@lntvow/eslint-config 9.1.2 → 9.2.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/package.json +4 -1
- package/.czrc +0 -3
- package/.editorconfig +0 -14
- package/.env.development +0 -1
- package/.env.production +0 -1
- package/.env.uat +0 -1
- package/.github/workflows/publish-npm.yml +0 -44
- package/.husky/commit-msg +0 -4
- package/.husky/pre-commit +0 -4
- package/.lintstagedrc +0 -4
- package/.prettierrc +0 -10
- package/.vscode/settings.json +0 -14
- package/api/basic.js +0 -22
- package/api/vue.js +0 -34
- package/commitlint.config.cjs +0 -4
- package/eslint.config.js +0 -21
- package/packages/eslint-config-ts/index.js +0 -85
- package/packages/eslint-config-ts/package.json +0 -18
- package/packages/eslint-plugin/index.js +0 -5
- package/packages/eslint-plugin/package.json +0 -16
- package/packages/eslint-plugin/rules/get.js +0 -18
- package/packages/eslint-plugin/test/get.test.js +0 -39
- package/src/configs/gitignore.ts +0 -34
- package/src/configs/ignores.ts +0 -10
- package/src/configs/imports.ts +0 -17
- package/src/configs/index.ts +0 -8
- package/src/configs/javascript.ts +0 -161
- package/src/configs/prettier.ts +0 -18
- package/src/configs/stylistic.ts +0 -59
- package/src/configs/typescript.ts +0 -63
- package/src/configs/vue.ts +0 -316
- package/src/factory.ts +0 -167
- package/src/globs.ts +0 -86
- package/src/index.ts +0 -7
- package/src/typegen.d.ts +0 -15123
- package/src/types.ts +0 -127
- package/src/typings/index.d.ts +0 -3
- package/src/utils/index.ts +0 -30
- package/test/js.vue +0 -28
- package/test/jsx.vue +0 -27
- package/test/test.js +0 -11
- package/test/test.ts +0 -18
- package/test/ts.vue +0 -26
- package/test/tsx.vue +0 -23
- package/tsconfig.json +0 -20
- package/tsup.config.ts +0 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lntvow/eslint-config",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"author": "lntvow",
|
|
5
5
|
"description": "eslint-config",
|
|
6
6
|
"type": "module",
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
"node": ">=18.12.0",
|
|
10
10
|
"pnpm": ">=9.0.0"
|
|
11
11
|
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
12
15
|
"main": "./dist/index.js",
|
|
13
16
|
"module": "./dist/index.js",
|
|
14
17
|
"types": "./dist/index.d.ts",
|
package/.czrc
DELETED
package/.editorconfig
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# https://editorconfig.org
|
|
2
|
-
root = true
|
|
3
|
-
|
|
4
|
-
[*]
|
|
5
|
-
charset = utf-8
|
|
6
|
-
indent_style = space
|
|
7
|
-
indent_size = 2
|
|
8
|
-
end_of_line = lf
|
|
9
|
-
insert_final_newline = true
|
|
10
|
-
trim_trailing_whitespace = true
|
|
11
|
-
|
|
12
|
-
[*.md]
|
|
13
|
-
insert_final_newline = false
|
|
14
|
-
trim_trailing_whitespace = false
|
package/.env.development
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VITE_BASE = '/xxxxx/'
|
package/.env.production
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VITE_BASE = '/xxxxx/'
|
package/.env.uat
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VITE_BASE = '/xxxxx/'
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
name: publish-npm
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
push:
|
|
6
|
-
paths:
|
|
7
|
-
# - 'package.json'
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
publish-npm:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
timeout-minutes: 10
|
|
13
|
-
steps:
|
|
14
|
-
- name: Checkout
|
|
15
|
-
uses: actions/checkout@v3
|
|
16
|
-
|
|
17
|
-
- name: Set Node
|
|
18
|
-
uses: actions/setup-node@v3
|
|
19
|
-
with:
|
|
20
|
-
node-version: 20
|
|
21
|
-
registry-url: https://registry.npmjs.org
|
|
22
|
-
|
|
23
|
-
- name: Set pnpm
|
|
24
|
-
uses: pnpm/action-setup@v2
|
|
25
|
-
with:
|
|
26
|
-
version: 9
|
|
27
|
-
|
|
28
|
-
- name: Get pnpm store directory
|
|
29
|
-
shell: bash
|
|
30
|
-
run: |
|
|
31
|
-
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
32
|
-
|
|
33
|
-
- uses: actions/cache@v3
|
|
34
|
-
name: Setup pnpm cache
|
|
35
|
-
with:
|
|
36
|
-
path: ${{ env.STORE_PATH }}
|
|
37
|
-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
38
|
-
restore-keys: |
|
|
39
|
-
${{ runner.os }}-pnpm-store-
|
|
40
|
-
|
|
41
|
-
- run: pnpm install
|
|
42
|
-
- run: pnpm publish --access public
|
|
43
|
-
env:
|
|
44
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH}}
|
package/.husky/commit-msg
DELETED
package/.husky/pre-commit
DELETED
package/.lintstagedrc
DELETED
package/.prettierrc
DELETED
package/.vscode/settings.json
DELETED
package/api/basic.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as cheerio from 'cheerio'
|
|
2
|
-
import axios from 'axios'
|
|
3
|
-
import { javascript } from '../dist/index.js'
|
|
4
|
-
|
|
5
|
-
// Const basicKeys = Object.keys(basicRules);
|
|
6
|
-
const rulesMap = {}
|
|
7
|
-
|
|
8
|
-
axios.get('https://eslint.org/docs/latest/rules/').then(async res => {
|
|
9
|
-
const $ = cheerio.load(res.data),
|
|
10
|
-
filteredElements = $('.rule').filter((i, e) => !($(e).is('.rule--deprecated') || $(e).is('.rule--removed')))
|
|
11
|
-
|
|
12
|
-
filteredElements.each((i, el) => {
|
|
13
|
-
const ruleName = $(el).find('.rule__name').text()
|
|
14
|
-
rulesMap[ruleName] = 2
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
const keyList = Object.keys(rulesMap)
|
|
18
|
-
const rulesList = Object.keys((await javascript())[0].rules)
|
|
19
|
-
|
|
20
|
-
const diff = keyList.filter(key => !rulesList.includes(key))
|
|
21
|
-
console.log('diff: ', diff)
|
|
22
|
-
})
|
package/api/vue.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/* eslint-disable unicorn/prefer-top-level-await */
|
|
2
|
-
const axios = require('axios')
|
|
3
|
-
const cheerio = require('cheerio')
|
|
4
|
-
const { rules } = require('../packages/eslint-config-vue')
|
|
5
|
-
|
|
6
|
-
const keys = Object.keys(rules)
|
|
7
|
-
const eslintKeys = []
|
|
8
|
-
|
|
9
|
-
axios.get('https://eslint.vuejs.org/rules/').then(res => {
|
|
10
|
-
const $ = cheerio.load(res.data)
|
|
11
|
-
|
|
12
|
-
const filteredElements = $('.group').filter((i, e) => {
|
|
13
|
-
return ['Extension Rules', 'Uncategorized'].includes($(e).find('.item[tabindex="0"] .text').text())
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
filteredElements.each((i, el) => {
|
|
17
|
-
const list = $(el).find('.items .is-link')
|
|
18
|
-
list.each((i, e) => {
|
|
19
|
-
const ruleName = $(e).find('.item .text').text()
|
|
20
|
-
eslintKeys.push(ruleName)
|
|
21
|
-
})
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const diff = eslintKeys.filter(key => !keys.includes(key))
|
|
25
|
-
console.log('eslintKeys: ', eslintKeys)
|
|
26
|
-
console.log('diff: ', diff)
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated 使用 isEmail
|
|
31
|
-
*/
|
|
32
|
-
export function validatorEmail(value) {
|
|
33
|
-
return /^([\w-])+@([\w-])+(\.[\w-])+/.test(value)
|
|
34
|
-
}
|
package/commitlint.config.cjs
DELETED
package/eslint.config.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import pluginStylistic from '@stylistic/eslint-plugin'
|
|
2
|
-
import { lntvow, GLOB_SRC, renameRules } from './dist/index.js'
|
|
3
|
-
|
|
4
|
-
const config = await lntvow({
|
|
5
|
-
vue: true,
|
|
6
|
-
typescript: true,
|
|
7
|
-
gitignore: {
|
|
8
|
-
},
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
const files = [GLOB_SRC]
|
|
12
|
-
|
|
13
|
-
// 1
|
|
14
|
-
export default [
|
|
15
|
-
...config,
|
|
16
|
-
{
|
|
17
|
-
// rules: {
|
|
18
|
-
// 'style/quotes': 'error',
|
|
19
|
-
// },
|
|
20
|
-
},
|
|
21
|
-
]
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: [
|
|
3
|
-
'@lntvow/eslint-config-basic',
|
|
4
|
-
'plugin:import/typescript',
|
|
5
|
-
'plugin:@typescript-eslint/strict',
|
|
6
|
-
'plugin:@typescript-eslint/stylistic',
|
|
7
|
-
],
|
|
8
|
-
settings: {
|
|
9
|
-
'import/resolver': { typescript: true },
|
|
10
|
-
},
|
|
11
|
-
overrides: [
|
|
12
|
-
{
|
|
13
|
-
files: ['*.js', '*.cjs'],
|
|
14
|
-
// 禁用js文件的类型检查
|
|
15
|
-
extends: ['plugin:@typescript-eslint/disable-type-checked'],
|
|
16
|
-
rules: {
|
|
17
|
-
'@typescript-eslint/no-var-requires': 0, // 允许使用require
|
|
18
|
-
'@typescript-eslint/consistent-type-assertions': 0, // 禁用js文件的类型检查
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
files: ['*.ts', '*.tsx', '*.d.ts'],
|
|
23
|
-
// 禁用js文件的类型检查
|
|
24
|
-
rules: {
|
|
25
|
-
'spaced-comment': 0, // 警用注释检查
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
files: ['*.ts', '*.tsx', '*.vue'],
|
|
30
|
-
rules: {
|
|
31
|
-
/**
|
|
32
|
-
* 重写import规则
|
|
33
|
-
*/
|
|
34
|
-
'import/namespace': 0, // 导入校验
|
|
35
|
-
'import/no-cycle': 0, // 循环导入
|
|
36
|
-
'import/no-unused-modules': 0, // 导入未使用的模块
|
|
37
|
-
'import/no-named-as-default': 0, // 校验导出名称
|
|
38
|
-
'import/no-unresolved': 0, // 导入目录校验
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 重写ts规则
|
|
42
|
-
*/
|
|
43
|
-
'@typescript-eslint/no-non-null-assertion': 0, // 允许使用!断言
|
|
44
|
-
'@typescript-eslint/ban-types': 0, // 允许使用object
|
|
45
|
-
'@typescript-eslint/no-explicit-any': 0, // 允许使用any
|
|
46
|
-
'@typescript-eslint/ban-ts-comment': 0, // 允许使用ts注释
|
|
47
|
-
|
|
48
|
-
'@typescript-eslint/no-unused-vars': 1, // 未使用的变量 警告
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 重写js规则
|
|
52
|
-
*/
|
|
53
|
-
'no-undef': 0, // ts自带 允许使用未定义的变量
|
|
54
|
-
'no-use-before-define': 0,
|
|
55
|
-
'@typescript-eslint/no-use-before-define': [
|
|
56
|
-
2,
|
|
57
|
-
{
|
|
58
|
-
functions: false,
|
|
59
|
-
classes: true,
|
|
60
|
-
variables: false,
|
|
61
|
-
allowNamedExports: false,
|
|
62
|
-
enums: true,
|
|
63
|
-
typedefs: true,
|
|
64
|
-
ignoreTypeReferences: true,
|
|
65
|
-
},
|
|
66
|
-
], // 变量定义前禁止使用
|
|
67
|
-
'lines-around-comment': 'off',
|
|
68
|
-
'@typescript-eslint/lines-around-comment': [
|
|
69
|
-
2,
|
|
70
|
-
{
|
|
71
|
-
allowBlockStart: true,
|
|
72
|
-
allowObjectStart: true,
|
|
73
|
-
allowArrayStart: true,
|
|
74
|
-
allowClassStart: true,
|
|
75
|
-
allowEnumStart: true,
|
|
76
|
-
allowInterfaceStart: true,
|
|
77
|
-
allowModuleStart: true,
|
|
78
|
-
allowTypeStart: true,
|
|
79
|
-
},
|
|
80
|
-
], // 注释空行,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
rules: {},
|
|
85
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@lntvow/eslint-config-ts",
|
|
3
|
-
"version": "8.5.0",
|
|
4
|
-
"description": "eslint/ts配置文件",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"keywords": [],
|
|
7
|
-
"author": "lntvow",
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"files": [
|
|
10
|
-
"index.js"
|
|
11
|
-
],
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@lntvow/eslint-config-basic": "workspace:*",
|
|
14
|
-
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
|
15
|
-
"@typescript-eslint/parser": "^6.2.0",
|
|
16
|
-
"eslint-import-resolver-typescript": "^3.5.5"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@lntvow/eslint-plugin",
|
|
3
|
-
"version": "8.5.0",
|
|
4
|
-
"description": "eslint/plugin文件",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"keywords": [],
|
|
7
|
-
"author": "lntvow",
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"files": [
|
|
10
|
-
"index.js"
|
|
11
|
-
],
|
|
12
|
-
"dependencies": {},
|
|
13
|
-
"peerDependencies": {
|
|
14
|
-
"eslint": ">=8.43.0"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
create(content) {
|
|
3
|
-
const options = content.options[1]
|
|
4
|
-
return {
|
|
5
|
-
ExpressionStatement(node) {
|
|
6
|
-
const callee = node.expression.callee
|
|
7
|
-
console.log('callee: ', callee)
|
|
8
|
-
const name = callee.property.name
|
|
9
|
-
if (options[name] === 2) {
|
|
10
|
-
content.report({
|
|
11
|
-
node,
|
|
12
|
-
message: `不能使用console.${name}`,
|
|
13
|
-
})
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const rule = require('../rules/get')
|
|
2
|
-
const RuleTester = require('eslint').RuleTester
|
|
3
|
-
|
|
4
|
-
const ruleTester = new RuleTester()
|
|
5
|
-
|
|
6
|
-
ruleTester.run('get', rule, {
|
|
7
|
-
valid: [
|
|
8
|
-
{
|
|
9
|
-
name: 'success',
|
|
10
|
-
code: 'var a = 10',
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
invalid: [
|
|
14
|
-
{
|
|
15
|
-
name: 'hash log',
|
|
16
|
-
code: "console.log('context: ', context.options)",
|
|
17
|
-
options: [
|
|
18
|
-
2,
|
|
19
|
-
{
|
|
20
|
-
log: 2,
|
|
21
|
-
warn: 2,
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
errors: [{ message: '不能使用console.log' }],
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: 'hash warn',
|
|
28
|
-
code: "console.warn('context: ', context.options)",
|
|
29
|
-
options: [
|
|
30
|
-
2,
|
|
31
|
-
{
|
|
32
|
-
log: 2,
|
|
33
|
-
warn: 2,
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
errors: [{ message: '不能使用console.warn' }],
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
})
|
package/src/configs/gitignore.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import { findUpSync } from 'find-up'
|
|
3
|
-
import { castArray } from '@lntvow/utils'
|
|
4
|
-
import parse from 'parse-gitignore'
|
|
5
|
-
import type { FlatGitignoreOptions, TypedFlatConfigItem } from '../types'
|
|
6
|
-
|
|
7
|
-
export async function gitignore(options: FlatGitignoreOptions): Promise<TypedFlatConfigItem[]> {
|
|
8
|
-
const { name = '.gitignore', root = false, files: _files = root ? name : findUpSync(name) || [] } = options
|
|
9
|
-
const files = castArray(_files)
|
|
10
|
-
|
|
11
|
-
const ignores = []
|
|
12
|
-
for (const file of files) {
|
|
13
|
-
try {
|
|
14
|
-
const content = fs.readFileSync(file, 'utf8')
|
|
15
|
-
|
|
16
|
-
const globs = parse(content).globs()
|
|
17
|
-
for (const glob of globs) {
|
|
18
|
-
if (glob.type === 'ignore') {
|
|
19
|
-
ignores.push(...glob.patterns)
|
|
20
|
-
} else if (glob.type === 'unignore') {
|
|
21
|
-
ignores.push(...glob.patterns.map((pattern: string) => `!${pattern}`))
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
} catch (error) {
|
|
25
|
-
throw new Error(`Failed to read file: ${file}`)
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return [
|
|
30
|
-
{
|
|
31
|
-
ignores,
|
|
32
|
-
},
|
|
33
|
-
]
|
|
34
|
-
}
|
package/src/configs/ignores.ts
DELETED
package/src/configs/imports.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import pluginImport from 'eslint-plugin-import-x'
|
|
2
|
-
import type { TypedFlatConfigItem } from '../types'
|
|
3
|
-
|
|
4
|
-
export async function imports(): Promise<TypedFlatConfigItem[]> {
|
|
5
|
-
return [
|
|
6
|
-
{
|
|
7
|
-
name: 'lntvow/imports/rules',
|
|
8
|
-
plugins: {
|
|
9
|
-
import: pluginImport,
|
|
10
|
-
},
|
|
11
|
-
rules: {
|
|
12
|
-
'import/order': 'error',
|
|
13
|
-
'import/newline-after-import': 'error',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
]
|
|
17
|
-
}
|
package/src/configs/index.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js'
|
|
2
|
-
import globals from 'globals'
|
|
3
|
-
import type { OptionsOverrides, TypedFlatConfigItem } from '../types'
|
|
4
|
-
|
|
5
|
-
export async function javascript(options: OptionsOverrides = {}): Promise<TypedFlatConfigItem[]> {
|
|
6
|
-
const { overrides = {} } = options
|
|
7
|
-
return [
|
|
8
|
-
{
|
|
9
|
-
name: 'lntvow/javascript/rules',
|
|
10
|
-
languageOptions: {
|
|
11
|
-
ecmaVersion: 2022,
|
|
12
|
-
sourceType: 'module',
|
|
13
|
-
parserOptions: {
|
|
14
|
-
ecmaVersion: 2022,
|
|
15
|
-
sourceType: 'module',
|
|
16
|
-
ecmaFeatures: {
|
|
17
|
-
jsx: true,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
globals: {
|
|
21
|
-
...globals.browser,
|
|
22
|
-
...globals.es2021,
|
|
23
|
-
...globals.node,
|
|
24
|
-
document: 'readonly',
|
|
25
|
-
navigator: 'readonly',
|
|
26
|
-
window: 'readonly',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
linterOptions: {
|
|
30
|
-
reportUnusedDisableDirectives: true,
|
|
31
|
-
},
|
|
32
|
-
rules: {
|
|
33
|
-
// Update to eslint-plugin-vue v9.3.0
|
|
34
|
-
...js.configs.all.rules,
|
|
35
|
-
// 禁止未使用过的变量
|
|
36
|
-
'no-unused-vars': 'warn',
|
|
37
|
-
// 禁止定义前使用
|
|
38
|
-
'no-use-before-define': ['error', { functions: false }],
|
|
39
|
-
// 强制使用骆驼拼写法命名约定
|
|
40
|
-
'camelcase': 'warn',
|
|
41
|
-
// 强制注释首字母大写或小写
|
|
42
|
-
'capitalized-comments': 'off',
|
|
43
|
-
// 强制类方法使用this
|
|
44
|
-
'class-methods-use-this': 'off',
|
|
45
|
-
// 指定程序中允许的最大环路复杂度
|
|
46
|
-
'complexity': 'off',
|
|
47
|
-
// 强制保证多行所有的花括号,
|
|
48
|
-
'curly': ['error', 'multi-line'],
|
|
49
|
-
// 要求使用命名的 function 表达式 便于调试
|
|
50
|
-
'func-names': 'off',
|
|
51
|
-
// 强制一致地使用 function 声明或表达式
|
|
52
|
-
'func-style': 'off',
|
|
53
|
-
// 要求 for-in 循环中有一个 if 语句
|
|
54
|
-
'guard-for-in': 'off',
|
|
55
|
-
// 禁用指定的标识符
|
|
56
|
-
'id-denylist': 'off',
|
|
57
|
-
// 强制标识符的最小和最大长度
|
|
58
|
-
'id-length': 'off',
|
|
59
|
-
// 禁止使用指定的标识符
|
|
60
|
-
'id-match': 'off',
|
|
61
|
-
// 要求变量声明并同时初始化
|
|
62
|
-
'init-declarations': 'off',
|
|
63
|
-
// 强制每个文件中包含的的类的最大数量
|
|
64
|
-
'max-classes-per-file': 'off',
|
|
65
|
-
// 强制可嵌套的块的最大深度
|
|
66
|
-
'max-depth': 'off',
|
|
67
|
-
// 强制最大行数
|
|
68
|
-
'max-lines': 'off',
|
|
69
|
-
// 强制函数最大行数
|
|
70
|
-
'max-lines-per-function': 'off',
|
|
71
|
-
// 强制回调函数最大嵌套深度
|
|
72
|
-
'max-nested-callbacks': 'off',
|
|
73
|
-
// 强制函数定义中最多允许的参数数量
|
|
74
|
-
'max-params': 'off',
|
|
75
|
-
// 强制函数块最多允许的的语句数量
|
|
76
|
-
'max-statements': 'off',
|
|
77
|
-
// 要求构造函数首字母大写
|
|
78
|
-
'new-cap': ['error', { capIsNew: false }],
|
|
79
|
-
// 禁止使用按位操作符
|
|
80
|
-
'no-bitwise': 'off',
|
|
81
|
-
// 禁止在 case 或 default 子句中出现词法声明
|
|
82
|
-
'no-case-declarations': 'off',
|
|
83
|
-
// 禁止使用 console
|
|
84
|
-
'no-console': 'warn',
|
|
85
|
-
// 禁用 continue 语句
|
|
86
|
-
'no-continue': 'off',
|
|
87
|
-
// 禁止空块语句
|
|
88
|
-
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
89
|
-
// 禁止使用短符号进行类型转换
|
|
90
|
-
'no-implicit-coercion': 'off',
|
|
91
|
-
// 禁止在全局范围内使用变量声明和 function 声明
|
|
92
|
-
'no-implicit-globals': 'off',
|
|
93
|
-
// 禁用魔术数字
|
|
94
|
-
'no-magic-numbers': ['warn', { ignoreArrayIndexes: true, ignoreDefaultValues: true }],
|
|
95
|
-
// 禁用嵌套的三元表达式
|
|
96
|
-
'no-nested-ternary': 'off',
|
|
97
|
-
// 禁止空 new 以避免产生副作用
|
|
98
|
-
'no-new': 'off',
|
|
99
|
-
// 禁止对 function 的参数进行重新赋值
|
|
100
|
-
'no-param-reassign': 'off',
|
|
101
|
-
// 禁用一元操作符 ++ 和 --
|
|
102
|
-
'no-plusplus': 'off',
|
|
103
|
-
// 禁用特定导出名称
|
|
104
|
-
'no-restricted-exports': 'off',
|
|
105
|
-
// 禁用特定的全局变量
|
|
106
|
-
'no-restricted-globals': [
|
|
107
|
-
'error',
|
|
108
|
-
{ message: 'Use `globalThis` instead.', name: 'global' },
|
|
109
|
-
{ message: 'Use `globalThis` instead.', name: 'self' },
|
|
110
|
-
],
|
|
111
|
-
// 禁用特定的导入
|
|
112
|
-
'no-restricted-imports': 'off',
|
|
113
|
-
// 禁止使用对象的某些属性
|
|
114
|
-
'no-restricted-properties': [
|
|
115
|
-
'error',
|
|
116
|
-
{ message: 'Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.', property: '__proto__' },
|
|
117
|
-
{ message: 'Use `Object.defineProperty` instead.', property: '__defineGetter__' },
|
|
118
|
-
{ message: 'Use `Object.defineProperty` instead.', property: '__defineSetter__' },
|
|
119
|
-
{ message: 'Use `Object.getOwnPropertyDescriptor` instead.', property: '__lookupGetter__' },
|
|
120
|
-
{ message: 'Use `Object.getOwnPropertyDescriptor` instead.', property: '__lookupSetter__' },
|
|
121
|
-
],
|
|
122
|
-
// 禁用特定的语法
|
|
123
|
-
'no-restricted-syntax': 'off',
|
|
124
|
-
// 禁止变量声明与外层作用域的变量同名
|
|
125
|
-
'no-shadow': 'off',
|
|
126
|
-
// 禁用三元操作符
|
|
127
|
-
'no-ternary': 'off',
|
|
128
|
-
// 禁止抛出异常字面量
|
|
129
|
-
'no-throw-literal': 'off',
|
|
130
|
-
// 禁止标识符中有下划线
|
|
131
|
-
'no-underscore-dangle': 'off',
|
|
132
|
-
// 禁用 void 操作符
|
|
133
|
-
'no-void': 'off',
|
|
134
|
-
// 禁止在注释中使用特定的警告术语
|
|
135
|
-
'no-warning-comments': 'off',
|
|
136
|
-
// 强制函数中的变量在一起声明
|
|
137
|
-
'one-var': 'off',
|
|
138
|
-
// 禁止使用 Math.pow 幂运算符
|
|
139
|
-
'prefer-exponentiation-operator': 'off',
|
|
140
|
-
// 要求使用 Error 对象作为 Promise 拒绝的原因
|
|
141
|
-
'prefer-promise-reject-errors': 'off',
|
|
142
|
-
// 强制在parseInt()使用基数参数
|
|
143
|
-
'radix': 'off',
|
|
144
|
-
// 禁止使用不带 await 表达式的 async 函数
|
|
145
|
-
'require-await': 'off',
|
|
146
|
-
// 强制在RegExp上使用u标志
|
|
147
|
-
'require-unicode-regexp': 'off',
|
|
148
|
-
// imports排序 不好用
|
|
149
|
-
'sort-imports': 'off',
|
|
150
|
-
// 要求对象属性按序排列
|
|
151
|
-
'sort-keys': 'off',
|
|
152
|
-
// 要求同一个声明块中的变量按顺序排列
|
|
153
|
-
'sort-vars': 'off',
|
|
154
|
-
// 要求或禁止使用严格模式指令
|
|
155
|
-
'strict': 'off',
|
|
156
|
-
// Overrides
|
|
157
|
-
...overrides,
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
]
|
|
161
|
-
}
|
package/src/configs/prettier.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import pluginPrettier from 'eslint-plugin-prettier'
|
|
2
|
-
import prettierConfig from 'eslint-config-prettier'
|
|
3
|
-
import type { TypedFlatConfigItem } from '../types'
|
|
4
|
-
|
|
5
|
-
export async function prettier(): Promise<TypedFlatConfigItem[]> {
|
|
6
|
-
return [
|
|
7
|
-
{
|
|
8
|
-
name: 'lntvow/prettier/rules',
|
|
9
|
-
plugins: {
|
|
10
|
-
prettier: pluginPrettier,
|
|
11
|
-
},
|
|
12
|
-
rules: {
|
|
13
|
-
...prettierConfig.rules,
|
|
14
|
-
'prettier/prettier': 'warn',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
]
|
|
18
|
-
}
|