eslint-config-tencent 1.1.3 → 1.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/NOTICE CHANGED
@@ -17,6 +17,9 @@ Open Source Coding Guideline Licensed under the MIT License:
17
17
  1. typescript-eslint
18
18
  Copyright (c) 2019 typescript-eslint and other contributors
19
19
 
20
+ 2. ESLint Stylistic
21
+ Copyright (c) 2023 ESLint Stylistic contributors
22
+
20
23
 
21
24
  Terms of the MIT License:
22
25
  --------------------------------------------------------------------
package/README.md CHANGED
@@ -1742,7 +1742,7 @@ stages:
1742
1742
 
1743
1743
  > 原因? 在eslint文档中,一元操作符 `++` 和 `--`会自动添加分号,不同的空白可能会改变源代码的语义。建议使用 `num += 1` 这样的语句来做递增和递减,而不是使用 `num++` 或 `num ++` 。同时 `++num` 和 `num++` 的差异也使代码的可读性变差。不必要的增量和减量语句会导致无法预先明确递增/预递减值,这可能会导致程序中的意外行为。
1744
1744
 
1745
- > 但目前依然允许在 for loop 中使用 `++`、`--` 的语法,但依然建议尽快迁移到 `+= 1`、`-= 1` 的语法。 [#22](https://git.code.oa.com/standards/javascript/issues/22)
1745
+ > 但目前依然允许在 for loop 中使用 `++`、`--` 的语法,但依然建议尽快迁移到 `+= 1`、`-= 1` 的语法。 [#22](https://git.woa.com/standards/javascript/issues/22)
1746
1746
 
1747
1747
  ```javascript
1748
1748
  // bad, i = 11, j = 20
package/base-legacy.js CHANGED
@@ -1,4 +1,4 @@
1
- // https://git.code.oa.com/standards/javascript/issues/25
1
+ // https://git.woa.com/standards/javascript/issues/25
2
2
  module.exports = {
3
3
  extends: ['./base'],
4
4
  rules: {
package/base.js CHANGED
@@ -1,17 +1,17 @@
1
1
 
2
2
  /**
3
3
  * ESLint Config for Tencent
4
- * https://git.code.oa.com/standards/javascript
4
+ * https://git.woa.com/standards/javascript
5
5
  *
6
6
  * 贡献者:
7
7
  * xcatliu <xcaliu@tencent.com>
8
- * ziofatli <ziofatli@tencent.com
8
+ * ziofatli <ziofatli@tencent.com>
9
9
  *
10
10
  * 依赖版本:
11
- * eslint ^8.57.0
11
+ * eslint ^8.57.1
12
12
  * @babel/eslint-parser ^7.14.5
13
- * @typescript-eslint/parser undefined
14
- * @typescript-eslint/eslint-plugin undefined
13
+ * @stylistic/eslint-plugin ^3.1.0
14
+ * typescript-eslint ^8.61.0
15
15
  * eslint-plugin-import ^2.31.0
16
16
  *
17
17
  * 此文件是由脚本 scripts/build.ts 自动生成
package/flat/base.js CHANGED
@@ -1,17 +1,17 @@
1
1
 
2
2
  /**
3
3
  * ESLint Config for Tencent
4
- * https://git.code.oa.com/standards/javascript
4
+ * https://git.woa.com/standards/javascript
5
5
  *
6
6
  * 贡献者:
7
7
  * xcatliu <xcaliu@tencent.com>
8
- * ziofatli <ziofatli@tencent.com
8
+ * ziofatli <ziofatli@tencent.com>
9
9
  *
10
10
  * 依赖版本:
11
- * eslint ^8.57.0
11
+ * eslint ^8.57.1
12
12
  * @babel/eslint-parser ^7.14.5
13
- * @typescript-eslint/parser undefined
14
- * @typescript-eslint/eslint-plugin undefined
13
+ * @stylistic/eslint-plugin ^3.1.0
14
+ * typescript-eslint ^8.61.0
15
15
  * eslint-plugin-import ^2.31.0
16
16
  *
17
17
  * 此文件是由脚本 scripts/build.ts 自动生成
package/flat/import.js CHANGED
@@ -1,17 +1,17 @@
1
1
 
2
2
  /**
3
3
  * ESLint Config for Tencent
4
- * https://git.code.oa.com/standards/javascript
4
+ * https://git.woa.com/standards/javascript
5
5
  *
6
6
  * 贡献者:
7
7
  * xcatliu <xcaliu@tencent.com>
8
- * ziofatli <ziofatli@tencent.com
8
+ * ziofatli <ziofatli@tencent.com>
9
9
  *
10
10
  * 依赖版本:
11
- * eslint ^8.57.0
11
+ * eslint ^8.57.1
12
12
  * @babel/eslint-parser ^7.14.5
13
- * @typescript-eslint/parser undefined
14
- * @typescript-eslint/eslint-plugin undefined
13
+ * @stylistic/eslint-plugin ^3.1.0
14
+ * typescript-eslint ^8.61.0
15
15
  * eslint-plugin-import ^2.31.0
16
16
  *
17
17
  * 此文件是由脚本 scripts/build.ts 自动生成
package/flat/index.js CHANGED
@@ -1,25 +1,40 @@
1
1
  const tseslint = require('typescript-eslint');
2
+ const stylistic = require('@stylistic/eslint-plugin');
2
3
  const base = require('./base.js');
3
4
  const ts = require('./ts.js');
4
5
  const importexport = require('./import.js');
5
6
 
6
7
  module.exports = function tencentEslintConfig(options) {
7
- const configs = [
8
- base,
9
- importexport,
8
+ const namedConfigs = [
9
+ {
10
+ ...base,
11
+ name: '@tencent/eslint-config-base',
12
+ },
13
+ {
14
+ ...importexport,
15
+ name: '@tencent/eslint-config-import-export',
16
+ },
10
17
  ];
11
18
 
12
19
  if (options.tsconfigRootDir) {
13
- return tseslint.config(...configs, tseslint.configs.base, {
14
- languageOptions: {
15
- parserOptions: {
16
- project: options.project || true,
17
- tsconfigRootDir: options.tsconfigRootDir,
20
+ return tseslint.config(
21
+ ...namedConfigs,
22
+ tseslint.configs.base,
23
+ {
24
+ plugins: {
25
+ '@stylistic': stylistic,
18
26
  },
27
+ languageOptions: {
28
+ parserOptions: {
29
+ project: options.project || true,
30
+ tsconfigRootDir: options.tsconfigRootDir,
31
+ },
32
+ },
33
+ ...ts,
34
+ name: '@tencent/eslint-config-ts',
19
35
  },
20
- ...ts,
21
- });
36
+ );
22
37
  }
23
38
 
24
- return configs;
39
+ return namedConfigs;
25
40
  };
package/flat/prettier.js CHANGED
@@ -1,17 +1,17 @@
1
1
 
2
2
  /**
3
3
  * ESLint Config for Tencent
4
- * https://git.code.oa.com/standards/javascript
4
+ * https://git.woa.com/standards/javascript
5
5
  *
6
6
  * 贡献者:
7
7
  * xcatliu <xcaliu@tencent.com>
8
- * ziofatli <ziofatli@tencent.com
8
+ * ziofatli <ziofatli@tencent.com>
9
9
  *
10
10
  * 依赖版本:
11
- * eslint ^8.57.0
11
+ * eslint ^8.57.1
12
12
  * @babel/eslint-parser ^7.14.5
13
- * @typescript-eslint/parser undefined
14
- * @typescript-eslint/eslint-plugin undefined
13
+ * @stylistic/eslint-plugin ^3.1.0
14
+ * typescript-eslint ^8.61.0
15
15
  * eslint-plugin-import ^2.31.0
16
16
  *
17
17
  * 此文件是由脚本 scripts/build.ts 自动生成
package/flat/ts.js CHANGED
@@ -1,17 +1,17 @@
1
1
 
2
2
  /**
3
3
  * ESLint Config for Tencent
4
- * https://git.code.oa.com/standards/javascript
4
+ * https://git.woa.com/standards/javascript
5
5
  *
6
6
  * 贡献者:
7
7
  * xcatliu <xcaliu@tencent.com>
8
- * ziofatli <ziofatli@tencent.com
8
+ * ziofatli <ziofatli@tencent.com>
9
9
  *
10
10
  * 依赖版本:
11
- * eslint ^8.57.0
11
+ * eslint ^8.57.1
12
12
  * @babel/eslint-parser ^7.14.5
13
- * @typescript-eslint/parser undefined
14
- * @typescript-eslint/eslint-plugin undefined
13
+ * @stylistic/eslint-plugin ^3.1.0
14
+ * typescript-eslint ^8.61.0
15
15
  * eslint-plugin-import ^2.31.0
16
16
  *
17
17
  * 此文件是由脚本 scripts/build.ts 自动生成
@@ -51,9 +51,9 @@ module.exports = {
51
51
  */
52
52
  '@typescript-eslint/adjacent-overload-signatures': "error",
53
53
  /** 同 JS 规则的 TS 版本 */
54
- '@typescript-eslint/brace-style': "error",
54
+ '@stylistic/brace-style': "error",
55
55
  /** 同 JS 规则的 TS 版本 */
56
- '@typescript-eslint/comma-spacing': [
56
+ '@stylistic/comma-spacing': [
57
57
  "error",
58
58
  {
59
59
  "before": false,
@@ -88,12 +88,12 @@ module.exports = {
88
88
  /**
89
89
  * 要求或禁止在函数标识符和其调用之间有空格
90
90
  */
91
- '@typescript-eslint/func-call-spacing': [
91
+ '@stylistic/func-call-spacing': [
92
92
  "error",
93
93
  "never"
94
94
  ],
95
95
  /** 同 JS 规则的 TS 版本 */
96
- '@typescript-eslint/indent': [
96
+ '@stylistic/indent': [
97
97
  "warn",
98
98
  2,
99
99
  {
@@ -137,7 +137,7 @@ module.exports = {
137
137
  }
138
138
  ],
139
139
  /** 同 JS 规则的 TS 版本 */
140
- '@typescript-eslint/keyword-spacing': [
140
+ '@stylistic/keyword-spacing': [
141
141
  "error",
142
142
  {
143
143
  "overrides": {
@@ -389,7 +389,7 @@ module.exports = {
389
389
  */
390
390
  '@typescript-eslint/prefer-optional-chain': "error",
391
391
  /** 同 JS 规则的 TS 版本 */
392
- '@typescript-eslint/quotes': [
392
+ '@stylistic/quotes': [
393
393
  "warn",
394
394
  "single",
395
395
  {
@@ -397,12 +397,12 @@ module.exports = {
397
397
  }
398
398
  ],
399
399
  /** 同 JS 规则的 TS 版本 */
400
- '@typescript-eslint/semi': [
400
+ '@stylistic/semi': [
401
401
  "error",
402
402
  "always"
403
403
  ],
404
404
  /** 同 JS 规则的 TS 版本 */
405
- '@typescript-eslint/space-before-function-paren': [
405
+ '@stylistic/space-before-function-paren': [
406
406
  "error",
407
407
  {
408
408
  "anonymous": "always",
@@ -425,7 +425,7 @@ module.exports = {
425
425
  /**
426
426
  * 在类型注释周围需要一致的间距
427
427
  */
428
- '@typescript-eslint/type-annotation-spacing': "error",
428
+ '@stylistic/type-annotation-spacing': "error",
429
429
  /**
430
430
  * interface 和 type 定义时必须声明成员的类型
431
431
  */
package/import.js CHANGED
@@ -1,17 +1,17 @@
1
1
 
2
2
  /**
3
3
  * ESLint Config for Tencent
4
- * https://git.code.oa.com/standards/javascript
4
+ * https://git.woa.com/standards/javascript
5
5
  *
6
6
  * 贡献者:
7
7
  * xcatliu <xcaliu@tencent.com>
8
- * ziofatli <ziofatli@tencent.com
8
+ * ziofatli <ziofatli@tencent.com>
9
9
  *
10
10
  * 依赖版本:
11
- * eslint ^8.57.0
11
+ * eslint ^8.57.1
12
12
  * @babel/eslint-parser ^7.14.5
13
- * @typescript-eslint/parser undefined
14
- * @typescript-eslint/eslint-plugin undefined
13
+ * @stylistic/eslint-plugin ^3.1.0
14
+ * typescript-eslint ^8.61.0
15
15
  * eslint-plugin-import ^2.31.0
16
16
  *
17
17
  * 此文件是由脚本 scripts/build.ts 自动生成
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-tencent",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "ESLint Config for Tencent",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,17 +9,24 @@
9
9
  "dev:eslintrc": "nodemon",
10
10
  "dev:site": "parcel site/index.html --out-dir .cache",
11
11
  "build": "run-s build:eslintrc build:site",
12
- "build:eslintrc": "ts-node scripts/build.ts",
12
+ "build:eslintrc": "node -r ./config/eslint-env-preload.js ./node_modules/.bin/ts-node scripts/build.ts",
13
13
  "build:site": "run-s clear:dist build:html",
14
14
  "clear:dist": "rimraf ./dist",
15
15
  "build:html": "parcel build site/index.html --public-url ./",
16
16
  "test": "npm run lint && ts-node ./test/index.ts",
17
+ "test:eslint-matrix": "ts-node scripts/test-eslint-matrix.ts",
18
+ "test:flat-smoke": "node scripts/test-flat-smoke.js",
19
+ "test:rules": "node -r ./config/eslint-env-preload.js ./node_modules/.bin/ts-node ./test/index.ts",
17
20
  "test:rulesCoverage": "ts-node ./scripts/rulesCoverage.ts",
18
21
  "lint": "run-s eslint markdownlint",
19
- "eslint": "eslint ./test --ext .js,.jsx,.ts,.tsx,.vue --ignore-pattern \"bad.*\" .",
22
+ "eslint": "node scripts/run-eslint-lint.js",
20
23
  "markdownlint": "markdownlint --config ./.markdownlintrc.json README.md",
21
24
  "autotag": "node ./scripts/autoTag.js"
22
25
  },
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://git.woa.com/standards/javascript.git"
29
+ },
23
30
  "keywords": [
24
31
  "eslint",
25
32
  "eslintrc",
@@ -35,9 +42,10 @@
35
42
  "author": "",
36
43
  "contributors": [
37
44
  "xcatliu <xcaliu@tencent.com>",
38
- "ziofatli <ziofatli@tencent.com"
45
+ "ziofatli <ziofatli@tencent.com>"
39
46
  ],
40
47
  "license": "MIT",
48
+ "homepage": "https://git.woa.com/standards/javascript",
41
49
  "files": [
42
50
  "*.md",
43
51
  "*.js",
@@ -59,16 +67,17 @@
59
67
  "dependencies": {
60
68
  "@babel/eslint-parser": "^7.14.5",
61
69
  "@eslint/js": "^8.57.0",
70
+ "@stylistic/eslint-plugin": "^3.1.0",
62
71
  "eslint-plugin-chalk": "^1.0.0",
63
72
  "eslint-plugin-import": "^2.31.0",
64
73
  "eslint-plugin-prettier": "^3.4.0",
65
74
  "eslint-plugin-react": "^7.35.0",
66
75
  "eslint-plugin-vue": "^9.24.0",
67
- "typescript-eslint": "^7.18.0"
76
+ "typescript-eslint": "^8.61.0"
68
77
  },
69
78
  "peerDependencies": {
70
79
  "@babel/core": "^7.14.6",
71
- "eslint": ">= 7.28.0 < 10.0.0"
80
+ "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0"
72
81
  },
73
82
  "devDependencies": {
74
83
  "@types/cookie": "^0.4.0",
@@ -84,7 +93,7 @@
84
93
  "browserslist": "^4.17.6",
85
94
  "cookie": "^0.4.1",
86
95
  "doctrine": "^3.0.0",
87
- "eslint": "^8.57.0",
96
+ "eslint": "^8.57.1",
88
97
  "husky": "^6.0.0",
89
98
  "insert-tag": "^0.1.2",
90
99
  "markdownlint-cli": "^0.27.1",
@@ -100,7 +109,7 @@
100
109
  "rimraf": "^3.0.2",
101
110
  "semantic-release": "^17.4.4",
102
111
  "ts-node": "^10.0.0",
103
- "typescript": "^4.3.2",
112
+ "typescript": "^5.5.0",
104
113
  "vue-eslint-parser": "^7.6.0",
105
114
  "xml-escape": "^1.1.0"
106
115
  }
package/prettier.js CHANGED
@@ -1,17 +1,17 @@
1
1
 
2
2
  /**
3
3
  * ESLint Config for Tencent
4
- * https://git.code.oa.com/standards/javascript
4
+ * https://git.woa.com/standards/javascript
5
5
  *
6
6
  * 贡献者:
7
7
  * xcatliu <xcaliu@tencent.com>
8
- * ziofatli <ziofatli@tencent.com
8
+ * ziofatli <ziofatli@tencent.com>
9
9
  *
10
10
  * 依赖版本:
11
- * eslint ^8.57.0
11
+ * eslint ^8.57.1
12
12
  * @babel/eslint-parser ^7.14.5
13
- * @typescript-eslint/parser undefined
14
- * @typescript-eslint/eslint-plugin undefined
13
+ * @stylistic/eslint-plugin ^3.1.0
14
+ * typescript-eslint ^8.61.0
15
15
  * eslint-plugin-import ^2.31.0
16
16
  *
17
17
  * 此文件是由脚本 scripts/build.ts 自动生成
package/ts-legacy.js CHANGED
@@ -1,4 +1,4 @@
1
- // https://git.code.oa.com/standards/javascript/issues/73
1
+ // https://git.woa.com/standards/javascript/issues/73
2
2
  module.exports = {
3
3
  rules: {
4
4
  // 降级为 推荐
package/ts.js CHANGED
@@ -1,17 +1,17 @@
1
1
 
2
2
  /**
3
3
  * ESLint Config for Tencent
4
- * https://git.code.oa.com/standards/javascript
4
+ * https://git.woa.com/standards/javascript
5
5
  *
6
6
  * 贡献者:
7
7
  * xcatliu <xcaliu@tencent.com>
8
- * ziofatli <ziofatli@tencent.com
8
+ * ziofatli <ziofatli@tencent.com>
9
9
  *
10
10
  * 依赖版本:
11
- * eslint ^8.57.0
11
+ * eslint ^8.57.1
12
12
  * @babel/eslint-parser ^7.14.5
13
- * @typescript-eslint/parser undefined
14
- * @typescript-eslint/eslint-plugin undefined
13
+ * @stylistic/eslint-plugin ^3.1.0
14
+ * typescript-eslint ^8.61.0
15
15
  * eslint-plugin-import ^2.31.0
16
16
  *
17
17
  * 此文件是由脚本 scripts/build.ts 自动生成
@@ -20,13 +20,17 @@
20
20
  */
21
21
  module.exports = {
22
22
 
23
- parser: '@typescript-eslint/parser',
24
- parserOptions: {
25
- project: [
26
- './tsconfig.json',
27
- ],
28
- },
29
- plugins: ['@typescript-eslint'],rules:{
23
+ plugins: ['@typescript-eslint', '@stylistic'],
24
+ overrides: [
25
+ {
26
+ files: ['**/*.ts', '**/*.tsx'],
27
+ parser: '@typescript-eslint/parser',
28
+ parserOptions: {
29
+ project: true,
30
+ tsconfigRootDir: require('path').join(__dirname, '../..'),
31
+ },
32
+ },
33
+ ],rules:{
30
34
  'brace-style': 'off',
31
35
  'no-empty-function': 'off',
32
36
  // https://github.com/typescript-eslint/typescript-eslint/issues/491
@@ -58,9 +62,9 @@ module.exports = {
58
62
  */
59
63
  '@typescript-eslint/adjacent-overload-signatures': "error",
60
64
  /** 同 JS 规则的 TS 版本 */
61
- '@typescript-eslint/brace-style': "error",
65
+ '@stylistic/brace-style': "error",
62
66
  /** 同 JS 规则的 TS 版本 */
63
- '@typescript-eslint/comma-spacing': [
67
+ '@stylistic/comma-spacing': [
64
68
  "error",
65
69
  {
66
70
  "before": false,
@@ -95,12 +99,12 @@ module.exports = {
95
99
  /**
96
100
  * 要求或禁止在函数标识符和其调用之间有空格
97
101
  */
98
- '@typescript-eslint/func-call-spacing': [
102
+ '@stylistic/func-call-spacing': [
99
103
  "error",
100
104
  "never"
101
105
  ],
102
106
  /** 同 JS 规则的 TS 版本 */
103
- '@typescript-eslint/indent': [
107
+ '@stylistic/indent': [
104
108
  "warn",
105
109
  2,
106
110
  {
@@ -144,7 +148,7 @@ module.exports = {
144
148
  }
145
149
  ],
146
150
  /** 同 JS 规则的 TS 版本 */
147
- '@typescript-eslint/keyword-spacing': [
151
+ '@stylistic/keyword-spacing': [
148
152
  "error",
149
153
  {
150
154
  "overrides": {
@@ -396,7 +400,7 @@ module.exports = {
396
400
  */
397
401
  '@typescript-eslint/prefer-optional-chain': "error",
398
402
  /** 同 JS 规则的 TS 版本 */
399
- '@typescript-eslint/quotes': [
403
+ '@stylistic/quotes': [
400
404
  "warn",
401
405
  "single",
402
406
  {
@@ -404,12 +408,12 @@ module.exports = {
404
408
  }
405
409
  ],
406
410
  /** 同 JS 规则的 TS 版本 */
407
- '@typescript-eslint/semi': [
411
+ '@stylistic/semi': [
408
412
  "error",
409
413
  "always"
410
414
  ],
411
415
  /** 同 JS 规则的 TS 版本 */
412
- '@typescript-eslint/space-before-function-paren': [
416
+ '@stylistic/space-before-function-paren': [
413
417
  "error",
414
418
  {
415
419
  "anonymous": "always",
@@ -432,7 +436,7 @@ module.exports = {
432
436
  /**
433
437
  * 在类型注释周围需要一致的间距
434
438
  */
435
- '@typescript-eslint/type-annotation-spacing': "error",
439
+ '@stylistic/type-annotation-spacing': "error",
436
440
  /**
437
441
  * interface 和 type 定义时必须声明成员的类型
438
442
  */