@qualcomm-ui/eslint-config-typescript 2.0.0 → 3.0.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/base.js +11 -14
- package/index.d.ts +28 -35
- package/index.js +24 -5
- package/jsdoc.js +1 -1
- package/naming-conventions.js +4 -0
- package/package.json +28 -20
- package/sort-keys.js +7 -2
- package/strict-exports.js +6 -0
- package/style-guide.js +125 -71
- package/type-checks.js +15 -11
- package/performance.js +0 -15
package/base.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
|
2
2
|
// SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
3
3
|
|
|
4
|
-
import {defineConfig} from "eslint/config"
|
|
5
4
|
import tseslint from "typescript-eslint"
|
|
6
5
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ecmaFeatures: {jsx: true},
|
|
13
|
-
},
|
|
14
|
-
sourceType: "module",
|
|
6
|
+
export const typescriptLanguageOptions = {
|
|
7
|
+
ecmaVersion: 2022,
|
|
8
|
+
parser: tseslint.parser,
|
|
9
|
+
parserOptions: {
|
|
10
|
+
ecmaFeatures: {jsx: true},
|
|
15
11
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
sourceType: "module",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const typescriptPlugins = {
|
|
16
|
+
"@typescript-eslint": tseslint.plugin,
|
|
17
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -2,50 +2,31 @@ import type {ConfigObject} from "@eslint/core"
|
|
|
2
2
|
|
|
3
3
|
interface TypescriptConfigExport {
|
|
4
4
|
configs: {
|
|
5
|
-
/**
|
|
6
|
-
* Base TypeScript configuration with parser and plugin setup.
|
|
7
|
-
* Required for each config to work.
|
|
8
|
-
*/
|
|
9
|
-
base: ConfigObject
|
|
10
|
-
|
|
11
5
|
/**
|
|
12
6
|
* JSDoc validation rules (alignment, tag names, formatting).
|
|
13
7
|
* Use for code with public APIs or documentation requirements.
|
|
14
8
|
*/
|
|
15
|
-
jsdoc: ConfigObject
|
|
9
|
+
jsdoc: ConfigObject[]
|
|
16
10
|
|
|
17
11
|
/**
|
|
18
12
|
* TypeScript naming conventions (PascalCase for types, camelCase for
|
|
19
13
|
* properties, etc). Requires type information.
|
|
14
|
+
*
|
|
15
|
+
* This is included in the {@link recommended} config.
|
|
20
16
|
*/
|
|
21
|
-
namingConventions: ConfigObject
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Import optimizations for library code (consistent type imports, no side
|
|
25
|
-
* effects). Use for packages consumed by other projects.
|
|
26
|
-
*/
|
|
27
|
-
performance: ConfigObject
|
|
17
|
+
namingConventions: ConfigObject[]
|
|
28
18
|
|
|
29
19
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* const recommended = [
|
|
35
|
-
* qui.configs.base,
|
|
36
|
-
* qui.configs.styleGuide,
|
|
37
|
-
* qui.configs.sortKeys,
|
|
38
|
-
* qui.configs.typeChecks,
|
|
39
|
-
* qui.configs.namingConventions,
|
|
40
|
-
* ]
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* Usage:
|
|
20
|
+
* Recommended TypeScript configuration. This includes the settings from the
|
|
21
|
+
* `styleGuide`, `sortKeys`, `typeChecks`, and `namingConventions` configs. This
|
|
22
|
+
* rule requires type information, which can be provided via `languageOptions`.
|
|
23
|
+
* An example configuration is available below:
|
|
44
24
|
*
|
|
45
25
|
* @example
|
|
46
26
|
* ```js
|
|
47
27
|
* // eslint.config.js
|
|
48
28
|
* import {defineConfig} from "eslint/config"
|
|
29
|
+
* import tseslint from "typescript-eslint"
|
|
49
30
|
* import quiEslintTs from "@qualcomm-ui/eslint-config-typescript"
|
|
50
31
|
*
|
|
51
32
|
* export default defineConfig(
|
|
@@ -53,8 +34,14 @@ interface TypescriptConfigExport {
|
|
|
53
34
|
* // other settings
|
|
54
35
|
* },
|
|
55
36
|
* {
|
|
56
|
-
* extends: [
|
|
57
|
-
* files: [/*TS Files*\/]
|
|
37
|
+
* extends: [quiEslintTs.configs.recommended],
|
|
38
|
+
* files: [/*TS Files*\/],
|
|
39
|
+
* languageOptions: {
|
|
40
|
+
* parser: tseslint.parser,
|
|
41
|
+
* parserOptions: {
|
|
42
|
+
* projectService: true,
|
|
43
|
+
* },
|
|
44
|
+
* }
|
|
58
45
|
* },
|
|
59
46
|
* )
|
|
60
47
|
* ```
|
|
@@ -64,26 +51,32 @@ interface TypescriptConfigExport {
|
|
|
64
51
|
/**
|
|
65
52
|
* Sort object properties, interface members, and type definitions
|
|
66
53
|
* alphabetically.
|
|
54
|
+
*
|
|
55
|
+
* This is included in the {@link recommended} config.
|
|
67
56
|
*/
|
|
68
|
-
sortKeys: ConfigObject
|
|
57
|
+
sortKeys: ConfigObject[]
|
|
69
58
|
|
|
70
59
|
/**
|
|
71
60
|
* Enforce explicit type exports for public APIs (prevents runtime bloat).
|
|
72
61
|
* Use for library entry points and public exports.
|
|
73
62
|
*/
|
|
74
|
-
strictExports: ConfigObject
|
|
63
|
+
strictExports: ConfigObject[]
|
|
75
64
|
|
|
76
65
|
/**
|
|
77
66
|
* Code style rules (imports, formatting, unused code, etc).
|
|
78
|
-
* Enforces
|
|
67
|
+
* Enforces oxfmt, import ordering, and code quality standards.
|
|
68
|
+
*
|
|
69
|
+
* This is included in the {@link recommended} config.
|
|
79
70
|
*/
|
|
80
|
-
styleGuide: ConfigObject
|
|
71
|
+
styleGuide: ConfigObject[]
|
|
81
72
|
|
|
82
73
|
/**
|
|
83
74
|
* Type-aware linting rules (await-thenable, no-unsafe-call, etc).
|
|
84
75
|
* Requires TypeScript type information. Catches type-related bugs.
|
|
76
|
+
*
|
|
77
|
+
* This is included in the {@link recommended} config.
|
|
85
78
|
*/
|
|
86
|
-
typeChecks: ConfigObject
|
|
79
|
+
typeChecks: ConfigObject[]
|
|
87
80
|
}
|
|
88
81
|
}
|
|
89
82
|
|
package/index.js
CHANGED
|
@@ -1,19 +1,38 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {typescriptLanguageOptions} from "./base.js"
|
|
2
2
|
import jsdoc from "./jsdoc.js"
|
|
3
3
|
import namingConventions from "./naming-conventions.js"
|
|
4
|
-
import performance from "./performance.js"
|
|
5
4
|
import sortKeys from "./sort-keys.js"
|
|
6
5
|
import strictExports from "./strict-exports.js"
|
|
7
6
|
import styleGuide from "./style-guide.js"
|
|
8
7
|
import typeChecks from "./type-checks.js"
|
|
9
8
|
|
|
9
|
+
const [namingConventionsConfig] = namingConventions
|
|
10
|
+
const [sortKeysConfig] = sortKeys
|
|
11
|
+
const [styleGuideConfig] = styleGuide
|
|
12
|
+
const [typeChecksConfig] = typeChecks
|
|
13
|
+
|
|
14
|
+
const recommended = {
|
|
15
|
+
languageOptions: typescriptLanguageOptions,
|
|
16
|
+
name: "qui-typescript-recommended",
|
|
17
|
+
plugins: {
|
|
18
|
+
...namingConventionsConfig.plugins,
|
|
19
|
+
...sortKeysConfig.plugins,
|
|
20
|
+
...styleGuideConfig.plugins,
|
|
21
|
+
...typeChecksConfig.plugins,
|
|
22
|
+
},
|
|
23
|
+
rules: {
|
|
24
|
+
...namingConventionsConfig.rules,
|
|
25
|
+
...sortKeysConfig.rules,
|
|
26
|
+
...styleGuideConfig.rules,
|
|
27
|
+
...typeChecksConfig.rules,
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
|
|
10
31
|
export default {
|
|
11
32
|
configs: {
|
|
12
|
-
base,
|
|
13
33
|
jsdoc,
|
|
14
34
|
namingConventions,
|
|
15
|
-
|
|
16
|
-
recommended: [base, styleGuide, sortKeys, typeChecks, namingConventions],
|
|
35
|
+
recommended,
|
|
17
36
|
sortKeys,
|
|
18
37
|
strictExports,
|
|
19
38
|
styleGuide,
|
package/jsdoc.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
|
2
2
|
// SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
3
3
|
|
|
4
|
-
import {defineConfig} from "eslint/config"
|
|
5
4
|
import jsdoc from "eslint-plugin-jsdoc"
|
|
5
|
+
import {defineConfig} from "eslint/config"
|
|
6
6
|
|
|
7
7
|
export default defineConfig({
|
|
8
8
|
name: "qui-jsdoc",
|
package/naming-conventions.js
CHANGED
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
import {defineConfig} from "eslint/config"
|
|
5
5
|
|
|
6
|
+
import {typescriptLanguageOptions, typescriptPlugins} from "./base.js"
|
|
7
|
+
|
|
6
8
|
export default defineConfig({
|
|
9
|
+
languageOptions: typescriptLanguageOptions,
|
|
7
10
|
name: "qui-typechecked-naming-convention",
|
|
11
|
+
plugins: {...typescriptPlugins},
|
|
8
12
|
rules: {
|
|
9
13
|
"@typescript-eslint/naming-convention": [
|
|
10
14
|
"error",
|
package/package.json
CHANGED
|
@@ -1,38 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qualcomm-ui/eslint-config-typescript",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "QUI ESLint config for consistent TypeScript code",
|
|
5
|
-
"
|
|
5
|
+
"keywords": [
|
|
6
|
+
"config",
|
|
7
|
+
"eslint"
|
|
8
|
+
],
|
|
6
9
|
"license": "BSD-3-Clause-Clear",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
+
"author": "Ryan Bower",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/qualcomm/qualcomm-ui"
|
|
10
14
|
},
|
|
11
|
-
"type": "module",
|
|
12
|
-
"sideEffects": false,
|
|
13
15
|
"files": [
|
|
14
16
|
"index.d.ts",
|
|
15
17
|
"index.js",
|
|
16
18
|
"base.js",
|
|
17
19
|
"jsdoc.js",
|
|
18
|
-
"performance.js",
|
|
19
20
|
"sort-keys.js",
|
|
20
21
|
"style-guide.js",
|
|
21
22
|
"naming-conventions.js",
|
|
22
23
|
"type-checks.js",
|
|
23
24
|
"strict-exports.js"
|
|
24
25
|
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"sideEffects": false,
|
|
25
28
|
"main": "index.js",
|
|
26
29
|
"module": "index.js",
|
|
27
30
|
"types": "index.d.ts",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
28
34
|
"devDependencies": {
|
|
29
35
|
"@eslint/core": "^1.0.0",
|
|
30
|
-
"@qualcomm-ui/cli": "
|
|
36
|
+
"@qualcomm-ui/cli": "1.0.7",
|
|
37
|
+
"@qualcomm-ui/tsconfig": "2.3.0",
|
|
31
38
|
"@stylistic/eslint-plugin": "5.2.0",
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
33
|
-
"@typescript-eslint/parser": "8.
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "8.58.2",
|
|
40
|
+
"@typescript-eslint/parser": "8.58.2",
|
|
41
|
+
"cross-env": "^10.1.0",
|
|
34
42
|
"eslint-plugin-comment-length": "^2.2.1",
|
|
35
|
-
"
|
|
43
|
+
"eslint-plugin-oxfmt": "0.9.0",
|
|
44
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
45
|
+
"eslint-plugin-unicorn": "^68.0.0",
|
|
46
|
+
"typescript-eslint": "8.58.2"
|
|
36
47
|
},
|
|
37
48
|
"peerDependencies": {
|
|
38
49
|
"@eslint/js": ">=9.37.0",
|
|
@@ -40,20 +51,17 @@
|
|
|
40
51
|
"@typescript-eslint/eslint-plugin": ">=8.31.1",
|
|
41
52
|
"@typescript-eslint/parser": ">=8.31.1",
|
|
42
53
|
"eslint": ">=9.37.0",
|
|
43
|
-
"eslint-config-prettier": ">=10.1.2",
|
|
44
54
|
"eslint-import-resolver-typescript": ">=4.3.4",
|
|
45
55
|
"eslint-plugin-comment-length": ">=2.2.1",
|
|
46
56
|
"eslint-plugin-import": ">=2.31.0",
|
|
47
57
|
"eslint-plugin-jsdoc": ">=50.6.11",
|
|
48
|
-
"eslint-plugin-
|
|
58
|
+
"eslint-plugin-oxfmt": ">=0.9.0",
|
|
49
59
|
"eslint-plugin-perfectionist": ">=4.12.3",
|
|
60
|
+
"eslint-plugin-promise": ">=7.2.1",
|
|
61
|
+
"eslint-plugin-unicorn": ">=68.0.0",
|
|
50
62
|
"eslint-plugin-unused-imports": ">=4.1.4",
|
|
51
|
-
"
|
|
63
|
+
"oxfmt": ">=0.54.0",
|
|
52
64
|
"typescript": ">=5.7.3",
|
|
53
65
|
"typescript-eslint": ">=8.31.1"
|
|
54
|
-
}
|
|
55
|
-
"keywords": [
|
|
56
|
-
"eslint",
|
|
57
|
-
"config"
|
|
58
|
-
]
|
|
66
|
+
}
|
|
59
67
|
}
|
package/sort-keys.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
|
2
2
|
// SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
3
3
|
|
|
4
|
-
import {defineConfig} from "eslint/config"
|
|
5
4
|
import perfectionist from "eslint-plugin-perfectionist"
|
|
5
|
+
import {defineConfig} from "eslint/config"
|
|
6
|
+
|
|
7
|
+
/** @type {NonNullable<import("eslint").Linter.Config["plugins"]>} */
|
|
8
|
+
const plugins = {
|
|
9
|
+
perfectionist,
|
|
10
|
+
}
|
|
6
11
|
|
|
7
12
|
export default defineConfig({
|
|
8
13
|
name: "qui-sort-keys",
|
|
9
|
-
plugins
|
|
14
|
+
plugins,
|
|
10
15
|
rules: {
|
|
11
16
|
"perfectionist/sort-interfaces": [
|
|
12
17
|
"error",
|
package/strict-exports.js
CHANGED
|
@@ -3,8 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
import {defineConfig} from "eslint/config"
|
|
5
5
|
|
|
6
|
+
import {typescriptLanguageOptions, typescriptPlugins} from "./base.js"
|
|
7
|
+
|
|
6
8
|
export default defineConfig({
|
|
9
|
+
languageOptions: typescriptLanguageOptions,
|
|
7
10
|
name: "qui-typechecked-strict-exports",
|
|
11
|
+
plugins: {
|
|
12
|
+
...typescriptPlugins,
|
|
13
|
+
},
|
|
8
14
|
rules: {
|
|
9
15
|
"@typescript-eslint/consistent-type-exports": [
|
|
10
16
|
"error",
|
package/style-guide.js
CHANGED
|
@@ -2,27 +2,145 @@
|
|
|
2
2
|
// SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
3
3
|
|
|
4
4
|
import stylistic from "@stylistic/eslint-plugin"
|
|
5
|
-
import {defineConfig} from "eslint/config"
|
|
6
5
|
import commentLength from "eslint-plugin-comment-length"
|
|
7
6
|
import importPlugin from "eslint-plugin-import"
|
|
7
|
+
import eslintPluginOxfmt from "eslint-plugin-oxfmt"
|
|
8
8
|
import perfectionist from "eslint-plugin-perfectionist"
|
|
9
|
-
import
|
|
9
|
+
import promisePlugin from "eslint-plugin-promise"
|
|
10
|
+
import eslintPluginUnicorn from "eslint-plugin-unicorn"
|
|
10
11
|
import unusedImportsPlugin from "eslint-plugin-unused-imports"
|
|
12
|
+
import {defineConfig} from "eslint/config"
|
|
13
|
+
|
|
14
|
+
import {typescriptLanguageOptions, typescriptPlugins} from "./base.js"
|
|
15
|
+
|
|
16
|
+
const oxlintParityRules = {
|
|
17
|
+
"@typescript-eslint/no-dupe-class-members": "error",
|
|
18
|
+
"@typescript-eslint/no-loss-of-precision": "error",
|
|
19
|
+
"@typescript-eslint/no-redeclare": "off",
|
|
20
|
+
"@typescript-eslint/no-unused-private-class-members": "error",
|
|
21
|
+
"block-scoped-var": "error",
|
|
22
|
+
"constructor-super": "error",
|
|
23
|
+
curly: "error",
|
|
24
|
+
eqeqeq: ["error", "smart"],
|
|
25
|
+
"for-direction": "error",
|
|
26
|
+
"getter-return": "error",
|
|
27
|
+
"no-array-constructor": "off",
|
|
28
|
+
"no-async-promise-executor": "error",
|
|
29
|
+
"no-caller": "error",
|
|
30
|
+
"no-class-assign": "error",
|
|
31
|
+
"no-compare-neg-zero": "error",
|
|
32
|
+
"no-cond-assign": "error",
|
|
33
|
+
"no-const-assign": "error",
|
|
34
|
+
"no-constant-binary-expression": "error",
|
|
35
|
+
"no-constant-condition": "error",
|
|
36
|
+
"no-debugger": "error",
|
|
37
|
+
"no-delete-var": "warn",
|
|
38
|
+
"no-dupe-class-members": "off",
|
|
39
|
+
"no-dupe-else-if": "error",
|
|
40
|
+
"no-dupe-keys": "error",
|
|
41
|
+
"no-duplicate-case": "error",
|
|
42
|
+
"no-empty-character-class": "error",
|
|
43
|
+
"no-empty-pattern": "error",
|
|
44
|
+
"no-empty-static-block": "error",
|
|
45
|
+
"no-eval": "error",
|
|
46
|
+
"no-ex-assign": "error",
|
|
47
|
+
"no-extend-native": "error",
|
|
48
|
+
"no-extra-bind": "error",
|
|
49
|
+
"no-extra-boolean-cast": "error",
|
|
50
|
+
"no-func-assign": "error",
|
|
51
|
+
"no-global-assign": "error",
|
|
52
|
+
"no-implied-eval": "off",
|
|
53
|
+
"no-import-assign": "error",
|
|
54
|
+
"no-invalid-regexp": "error",
|
|
55
|
+
"no-irregular-whitespace": "error",
|
|
56
|
+
"no-iterator": "error",
|
|
57
|
+
"no-loss-of-precision": "off",
|
|
58
|
+
"no-misleading-character-class": "error",
|
|
59
|
+
"no-new-native-nonconstructor": "error",
|
|
60
|
+
"no-new-wrappers": "error",
|
|
61
|
+
"no-nonoctal-decimal-escape": "error",
|
|
62
|
+
"no-obj-calls": "error",
|
|
63
|
+
"no-object-constructor": "error",
|
|
64
|
+
"no-redeclare": "off",
|
|
65
|
+
"no-self-assign": "error",
|
|
66
|
+
"no-self-compare": "error",
|
|
67
|
+
"no-setter-return": "error",
|
|
68
|
+
"no-shadow-restricted-names": "error",
|
|
69
|
+
"no-sparse-arrays": "error",
|
|
70
|
+
"no-this-before-super": "error",
|
|
71
|
+
"no-unassigned-vars": "error",
|
|
72
|
+
"no-unreachable": "error",
|
|
73
|
+
"no-unsafe-finally": "error",
|
|
74
|
+
"no-unsafe-negation": "error",
|
|
75
|
+
"no-unsafe-optional-chaining": "error",
|
|
76
|
+
"no-unused-expressions": "off",
|
|
77
|
+
"no-unused-labels": "error",
|
|
78
|
+
"no-unused-private-class-members": "off",
|
|
79
|
+
"no-unused-vars": "off",
|
|
80
|
+
"no-useless-backreference": "error",
|
|
81
|
+
"no-useless-catch": "error",
|
|
82
|
+
"no-useless-concat": "error",
|
|
83
|
+
"no-useless-escape": "warn",
|
|
84
|
+
"no-useless-rename": "error",
|
|
85
|
+
"no-with": "error",
|
|
86
|
+
"object-shorthand": "error",
|
|
87
|
+
"prefer-const": "error",
|
|
88
|
+
"prefer-object-has-own": "error",
|
|
89
|
+
"prefer-spread": "error",
|
|
90
|
+
"prefer-template": "error",
|
|
91
|
+
"promise/always-return": "warn",
|
|
92
|
+
"promise/catch-or-return": "warn",
|
|
93
|
+
"promise/no-multiple-resolved": "error",
|
|
94
|
+
"promise/no-nesting": "error",
|
|
95
|
+
"promise/no-new-statics": "error",
|
|
96
|
+
"promise/no-return-in-finally": "warn",
|
|
97
|
+
"promise/no-return-wrap": "error",
|
|
98
|
+
"promise/param-names": "error",
|
|
99
|
+
"promise/spec-only": "error",
|
|
100
|
+
"require-yield": "error",
|
|
101
|
+
"use-isnan": "error",
|
|
102
|
+
"valid-typeof": "error",
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const unicornRules = {
|
|
106
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
107
|
+
"unicorn/no-for-each": "warn",
|
|
108
|
+
"unicorn/no-invalid-fetch-options": "error",
|
|
109
|
+
"unicorn/no-invalid-remove-event-listener": "error",
|
|
110
|
+
"unicorn/no-static-only-class": "error",
|
|
111
|
+
"unicorn/no-unnecessary-await": "error",
|
|
112
|
+
"unicorn/no-unreadable-iife": "error",
|
|
113
|
+
"unicorn/no-useless-length-check": "error",
|
|
114
|
+
"unicorn/prefer-array-find": "error",
|
|
115
|
+
"unicorn/prefer-node-protocol": "error",
|
|
116
|
+
"unicorn/prefer-set-size": "error",
|
|
117
|
+
"unicorn/prefer-string-trim-start-end": "error",
|
|
118
|
+
}
|
|
11
119
|
|
|
12
120
|
export default defineConfig({
|
|
121
|
+
languageOptions: typescriptLanguageOptions,
|
|
13
122
|
name: "qui-style-guide",
|
|
14
123
|
plugins: {
|
|
124
|
+
...typescriptPlugins,
|
|
15
125
|
"@stylistic": stylistic,
|
|
16
126
|
"comment-length": commentLength,
|
|
17
127
|
import: importPlugin,
|
|
128
|
+
oxfmt: eslintPluginOxfmt,
|
|
18
129
|
perfectionist,
|
|
19
|
-
|
|
130
|
+
promise: promisePlugin,
|
|
131
|
+
unicorn: eslintPluginUnicorn,
|
|
20
132
|
"unused-imports": unusedImportsPlugin,
|
|
21
133
|
},
|
|
22
134
|
rules: {
|
|
135
|
+
...oxlintParityRules,
|
|
136
|
+
...unicornRules,
|
|
23
137
|
...commentLength.configs["flat/recommended"].rules,
|
|
24
138
|
"@stylistic/spaced-comment": ["error", "always", {block: {balanced: true}}],
|
|
25
139
|
"@typescript-eslint/ban-ts-comment": "off",
|
|
140
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
141
|
+
"error",
|
|
142
|
+
{fixStyle: "inline-type-imports"},
|
|
143
|
+
],
|
|
26
144
|
"@typescript-eslint/explicit-member-accessibility": [
|
|
27
145
|
"error",
|
|
28
146
|
{
|
|
@@ -38,7 +156,7 @@ export default defineConfig({
|
|
|
38
156
|
],
|
|
39
157
|
"@typescript-eslint/no-empty-interface": "off",
|
|
40
158
|
"@typescript-eslint/no-extra-semi": "off",
|
|
41
|
-
"@typescript-eslint/no-
|
|
159
|
+
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
42
160
|
"@typescript-eslint/no-var-requires": "off",
|
|
43
161
|
"comment-length/limit-multi-line-comments": [
|
|
44
162
|
"warn",
|
|
@@ -54,63 +172,12 @@ export default defineConfig({
|
|
|
54
172
|
maxLength: 85,
|
|
55
173
|
},
|
|
56
174
|
],
|
|
57
|
-
curly: "error",
|
|
58
|
-
eqeqeq: [
|
|
59
|
-
"error",
|
|
60
|
-
"always",
|
|
61
|
-
{
|
|
62
|
-
null: "ignore",
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
175
|
"import/newline-after-import": ["error", {count: 1}],
|
|
66
|
-
"import/no-cycle":
|
|
176
|
+
"import/no-cycle": "off",
|
|
67
177
|
"import/no-duplicates": ["error", {"prefer-inline": true}],
|
|
68
|
-
"import/order":
|
|
69
|
-
"error",
|
|
70
|
-
{
|
|
71
|
-
alphabetize: {
|
|
72
|
-
caseInsensitive: true,
|
|
73
|
-
order: "asc",
|
|
74
|
-
},
|
|
75
|
-
groups: [
|
|
76
|
-
["builtin", "external"],
|
|
77
|
-
["internal"],
|
|
78
|
-
["parent"],
|
|
79
|
-
["sibling", "index"],
|
|
80
|
-
["unknown"],
|
|
81
|
-
],
|
|
82
|
-
"newlines-between": "always",
|
|
83
|
-
pathGroups: [
|
|
84
|
-
{
|
|
85
|
-
group: "external",
|
|
86
|
-
pattern: "react",
|
|
87
|
-
position: "before",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
group: "external",
|
|
91
|
-
pattern: "@qualcomm-ui/**",
|
|
92
|
-
position: "after",
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
group: "internal",
|
|
96
|
-
pattern: "~**",
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
group: "internal",
|
|
100
|
-
pattern: "~**/*",
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
group: "internal",
|
|
104
|
-
pattern: "~**/**",
|
|
105
|
-
},
|
|
106
|
-
],
|
|
107
|
-
pathGroupsExcludedImportTypes: ["react"],
|
|
108
|
-
},
|
|
109
|
-
],
|
|
178
|
+
"import/order": "off",
|
|
110
179
|
"multiline-comment-style": ["off"],
|
|
111
|
-
"no-array-constructor": "error",
|
|
112
180
|
"no-case-declarations": "off",
|
|
113
|
-
"no-const-assign": "error",
|
|
114
181
|
"no-duplicate-imports": "off",
|
|
115
182
|
"no-inner-declarations": "off",
|
|
116
183
|
"no-invalid-this": "off",
|
|
@@ -140,21 +207,8 @@ export default defineConfig({
|
|
|
140
207
|
},
|
|
141
208
|
],
|
|
142
209
|
"no-undef": "off",
|
|
143
|
-
"no-unused-vars": "off",
|
|
144
|
-
"no-useless-concat": "error",
|
|
145
|
-
"no-useless-escape": "warn",
|
|
146
210
|
"no-var": "error",
|
|
147
|
-
"
|
|
148
|
-
"prefer-const": "error",
|
|
149
|
-
"prefer-template": ["error"],
|
|
150
|
-
"prettier/prettier": "error",
|
|
151
|
-
"sort-imports": [
|
|
152
|
-
"error",
|
|
153
|
-
{
|
|
154
|
-
ignoreCase: true,
|
|
155
|
-
ignoreDeclarationSort: true,
|
|
156
|
-
},
|
|
157
|
-
],
|
|
211
|
+
"oxfmt/oxfmt": "error",
|
|
158
212
|
"unused-imports/no-unused-imports": "error",
|
|
159
213
|
"unused-imports/no-unused-vars": [
|
|
160
214
|
"error",
|
package/type-checks.js
CHANGED
|
@@ -3,19 +3,23 @@
|
|
|
3
3
|
|
|
4
4
|
import {defineConfig} from "eslint/config"
|
|
5
5
|
|
|
6
|
+
import {typescriptLanguageOptions, typescriptPlugins} from "./base.js"
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
|
-
* This configuration is based on
|
|
9
|
+
* This configuration is based on
|
|
10
|
+
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/recommended-type-checked.ts
|
|
8
11
|
*
|
|
9
|
-
* There are some key differences, primarily regarding rules involving `any`. We
|
|
10
|
-
* most of these to either warn or off:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* - External libraries that use `any` can cause issues with our own types.
|
|
12
|
+
* There are some key differences, primarily regarding rules involving `any`. We
|
|
13
|
+
* set most of these to either warn or off: - Interop with untyped JS is a real
|
|
14
|
+
* pain point where `any` is pragmatic. - Type gymnastics that satisfy the
|
|
15
|
+
* compiler but obscure intent can be worse than `any` - The ceremony of unknown
|
|
16
|
+
* + guards can be disproportionate to the actual risk. - External libraries
|
|
17
|
+
* that use `any` can cause issues with our own types.
|
|
16
18
|
*/
|
|
17
19
|
export default defineConfig({
|
|
20
|
+
languageOptions: typescriptLanguageOptions,
|
|
18
21
|
name: "qui-typechecked-recommended",
|
|
22
|
+
plugins: {...typescriptPlugins},
|
|
19
23
|
rules: {
|
|
20
24
|
"@typescript-eslint/await-thenable": "error",
|
|
21
25
|
"@typescript-eslint/ban-ts-comment": "warn", // Allow use of @ts-ignore, but warn
|
|
@@ -40,9 +44,9 @@ export default defineConfig({
|
|
|
40
44
|
"@typescript-eslint/no-namespace": "error",
|
|
41
45
|
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
42
46
|
/**
|
|
43
|
-
* Some projects choose to occasionally intentionally include a redundant
|
|
44
|
-
* constituent for documentation purposes. Like our icon, which is a
|
|
45
|
-
* `"xs" | "sm" | "md" | "lg" | "xl" | string | number`
|
|
47
|
+
* Some projects choose to occasionally intentionally include a redundant
|
|
48
|
+
* type constituent for documentation purposes. Like our icon, which is a
|
|
49
|
+
* union of: `"xs" | "sm" | "md" | "lg" | "xl" | string | number`
|
|
46
50
|
*/
|
|
47
51
|
"@typescript-eslint/no-redundant-type-constituents": "off",
|
|
48
52
|
"@typescript-eslint/no-require-imports": "error",
|
package/performance.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
|
2
|
-
// SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
3
|
-
|
|
4
|
-
import {defineConfig} from "eslint/config"
|
|
5
|
-
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
name: "qui-performance",
|
|
8
|
-
rules: {
|
|
9
|
-
"@typescript-eslint/consistent-type-imports": [
|
|
10
|
-
"error",
|
|
11
|
-
{fixStyle: "inline-type-imports"},
|
|
12
|
-
],
|
|
13
|
-
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
14
|
-
},
|
|
15
|
-
})
|