@cgzair/eslint-config-cgz 1.1.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/LICENSE +21 -0
- package/README.md +13 -0
- package/es5.js +9 -0
- package/index.js +23 -0
- package/jsx-a11y.js +3 -0
- package/node.js +3 -0
- package/package.json +74 -0
- package/react.js +8 -0
- package/rules/base/es6.js +76 -0
- package/rules/base/possible-errors.js +41 -0
- package/rules/base/recommended.js +112 -0
- package/rules/base/strict.js +5 -0
- package/rules/base/style.js +226 -0
- package/rules/base/variables.js +24 -0
- package/rules/imports.js +63 -0
- package/rules/jsx-a11y.js +18 -0
- package/rules/node.js +6 -0
- package/rules/react.js +177 -0
- package/rules/typescript.js +303 -0
- package/rules/uni-app.js +38 -0
- package/rules/vue.js +46 -0
- package/typescript/index.js +3 -0
- package/typescript/node.js +3 -0
- package/typescript/react.js +3 -0
- package/typescript/uni-app.js +3 -0
- package/typescript/vue.js +6 -0
- package/uni-app.js +3 -0
- package/vue.js +6 -0
package/rules/imports.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: ["import"],
|
|
3
|
+
settings: {
|
|
4
|
+
"import/ignore": ["node_modules", "\\.(coffee|scss|css|less|hbs|svg|json)$"],
|
|
5
|
+
},
|
|
6
|
+
rules: {
|
|
7
|
+
"import/no-unresolved": "off",
|
|
8
|
+
"import/named": "off",
|
|
9
|
+
"import/default": "off",
|
|
10
|
+
"import/namespace": "off",
|
|
11
|
+
"import/export": "off",
|
|
12
|
+
"import/no-named-as-default": "error",
|
|
13
|
+
"import/no-named-as-default-member": "warn",
|
|
14
|
+
"import/no-deprecated": "off",
|
|
15
|
+
"import/no-extraneous-dependencies": "off",
|
|
16
|
+
"import/no-mutable-exports": "off",
|
|
17
|
+
"import/unambiguous": "off",
|
|
18
|
+
"import/no-commonjs": "off",
|
|
19
|
+
"import/no-amd": "warn",
|
|
20
|
+
"import/no-nodejs-modules": "off",
|
|
21
|
+
"import/first": "error",
|
|
22
|
+
"import/no-duplicates": "error",
|
|
23
|
+
"import/no-namespace": "off",
|
|
24
|
+
"import/extensions": "off",
|
|
25
|
+
"import/order": [
|
|
26
|
+
"warn",
|
|
27
|
+
{
|
|
28
|
+
pathGroups: [
|
|
29
|
+
{
|
|
30
|
+
pattern: "**/~/**/*[.scss|.sass|.less|.css]",
|
|
31
|
+
group: "sibling",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
pattern: "**/@/**/*",
|
|
35
|
+
group: "external",
|
|
36
|
+
position: "after",
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
groups: ["builtin", "external", "internal", "type", "parent", "object", "index", "sibling"],
|
|
40
|
+
"newlines-between": "never",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
"import/newline-after-import": "warn",
|
|
44
|
+
"import/prefer-default-export": "off",
|
|
45
|
+
"import/no-restricted-paths": "off",
|
|
46
|
+
"import/max-dependencies": "off",
|
|
47
|
+
"import/no-absolute-path": "off",
|
|
48
|
+
"import/no-dynamic-require": "off",
|
|
49
|
+
"import/no-internal-modules": "off",
|
|
50
|
+
"import/no-webpack-loader-syntax": "off",
|
|
51
|
+
"import/no-unassigned-import": "off",
|
|
52
|
+
"import/no-named-default": "off",
|
|
53
|
+
"import/no-anonymous-default-export": "off",
|
|
54
|
+
"import/exports-last": "off",
|
|
55
|
+
"import/group-exports": "off",
|
|
56
|
+
"import/no-default-export": "off",
|
|
57
|
+
"import/no-self-import": "error",
|
|
58
|
+
"import/no-cycle": ["error", { maxDepth: Infinity }],
|
|
59
|
+
"import/no-useless-path-segments": "off",
|
|
60
|
+
"import/dynamic-import-chunkname": "off",
|
|
61
|
+
"import/no-relative-parent-imports": "off",
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: ["jsx-a11y"],
|
|
3
|
+
rules: {
|
|
4
|
+
"jsx-a11y/alt-text": "warn",
|
|
5
|
+
"jsx-a11y/img-redundant-alt": "warn",
|
|
6
|
+
"jsx-a11y/anchor-has-content": "warn",
|
|
7
|
+
"jsx-a11y/aria-props": "warn",
|
|
8
|
+
"jsx-a11y/aria-proptypes": "warn",
|
|
9
|
+
"jsx-a11y/aria-unsupported-elements": "warn",
|
|
10
|
+
"jsx-a11y/aria-role": ["warn", { ignoreNonDOM: true }],
|
|
11
|
+
"jsx-a11y/role-has-required-aria-props": "warn",
|
|
12
|
+
"jsx-a11y/role-supports-aria-props": "warn",
|
|
13
|
+
"jsx-a11y/iframe-has-title": "warn",
|
|
14
|
+
"jsx-a11y/no-access-key": "warn",
|
|
15
|
+
"jsx-a11y/no-distracting-elements": "warn",
|
|
16
|
+
"jsx-a11y/scope": "warn",
|
|
17
|
+
},
|
|
18
|
+
};
|
package/rules/node.js
ADDED
package/rules/react.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: ["react", "react-hooks"],
|
|
3
|
+
rules: {
|
|
4
|
+
"react/display-name": "off",
|
|
5
|
+
"react/forbid-prop-types": ["warn", { forbid: ["any"] }],
|
|
6
|
+
"react/jsx-boolean-value": ["error", "never", { always: [] }],
|
|
7
|
+
"react/jsx-closing-bracket-location": ["error", "line-aligned"],
|
|
8
|
+
"react/jsx-closing-tag-location": "error",
|
|
9
|
+
"react/jsx-props-no-multi-spaces": "error",
|
|
10
|
+
"react/jsx-curly-spacing": ["error", "never", { allowMultiline: true }],
|
|
11
|
+
"react/jsx-handler-names": [
|
|
12
|
+
"warn",
|
|
13
|
+
{
|
|
14
|
+
eventHandlerPrefix: "handle",
|
|
15
|
+
eventHandlerPropPrefix: "on",
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
"react/jsx-indent-props": ["error", 2],
|
|
19
|
+
"react/jsx-key": "error",
|
|
20
|
+
"react/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
|
|
21
|
+
"react/jsx-no-bind": [
|
|
22
|
+
"warn",
|
|
23
|
+
{
|
|
24
|
+
ignoreRefs: false,
|
|
25
|
+
allowArrowFunctions: true,
|
|
26
|
+
allowBind: false,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
"react/jsx-no-duplicate-props": ["error", { ignoreCase: true }],
|
|
30
|
+
"react/jsx-no-literals": "off",
|
|
31
|
+
"react/jsx-no-undef": "error",
|
|
32
|
+
"react/jsx-pascal-case": [
|
|
33
|
+
"error",
|
|
34
|
+
{
|
|
35
|
+
allowAllCaps: true,
|
|
36
|
+
ignore: [],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
"react/sort-prop-types": "off",
|
|
40
|
+
"react/jsx-sort-prop-types": "off",
|
|
41
|
+
"react/jsx-sort-props": "off",
|
|
42
|
+
"react/jsx-uses-react": ["error"],
|
|
43
|
+
"react/jsx-uses-vars": "error",
|
|
44
|
+
"react/no-danger": "warn",
|
|
45
|
+
"react/no-deprecated": "error",
|
|
46
|
+
"react/no-will-update-set-state": "error",
|
|
47
|
+
"react/no-direct-mutation-state": "off",
|
|
48
|
+
"react/no-is-mounted": "error",
|
|
49
|
+
"react/no-multi-comp": ["error", { ignoreStateless: true }],
|
|
50
|
+
"react/no-set-state": "off",
|
|
51
|
+
"react/no-string-refs": "error",
|
|
52
|
+
"react/no-this-in-sfc": "error",
|
|
53
|
+
"react/no-unknown-property": "error",
|
|
54
|
+
"react/prefer-es6-class": ["error", "always"],
|
|
55
|
+
"react/prefer-stateless-function": "off",
|
|
56
|
+
"react/prop-types": [
|
|
57
|
+
"warn",
|
|
58
|
+
{
|
|
59
|
+
ignore: [],
|
|
60
|
+
customValidators: [],
|
|
61
|
+
skipUndeclared: false,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
"react/react-in-jsx-scope": "off",
|
|
65
|
+
"react/require-render-return": "error",
|
|
66
|
+
"react/self-closing-comp": "error",
|
|
67
|
+
// 规则比较多,暂无开启,后期通过插件自动处理
|
|
68
|
+
"react/sort-comp": [
|
|
69
|
+
"off",
|
|
70
|
+
{
|
|
71
|
+
order: [
|
|
72
|
+
"static-methods",
|
|
73
|
+
"instance-variables",
|
|
74
|
+
"lifecycle",
|
|
75
|
+
"/^on.+$/",
|
|
76
|
+
"getters",
|
|
77
|
+
"setters",
|
|
78
|
+
"/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/",
|
|
79
|
+
"instance-methods",
|
|
80
|
+
"everything-else",
|
|
81
|
+
"rendering",
|
|
82
|
+
],
|
|
83
|
+
groups: {
|
|
84
|
+
lifecycle: [
|
|
85
|
+
"displayName",
|
|
86
|
+
"propTypes",
|
|
87
|
+
"contextTypes",
|
|
88
|
+
"childContextTypes",
|
|
89
|
+
"mixins",
|
|
90
|
+
"statics",
|
|
91
|
+
"defaultProps",
|
|
92
|
+
"constructor",
|
|
93
|
+
"getDefaultProps",
|
|
94
|
+
"getInitialState",
|
|
95
|
+
"state",
|
|
96
|
+
"getChildContext",
|
|
97
|
+
"componentWillMount",
|
|
98
|
+
"UNSAFE_componentWillMount",
|
|
99
|
+
"componentDidMount",
|
|
100
|
+
"componentWillReceiveProps",
|
|
101
|
+
"UNSAFE_componentWillReceiveProps",
|
|
102
|
+
"shouldComponentUpdate",
|
|
103
|
+
"componentWillUpdate",
|
|
104
|
+
"UNSAFE_componentWillUpdate",
|
|
105
|
+
"componentDidUpdate",
|
|
106
|
+
"componentWillUnmount",
|
|
107
|
+
],
|
|
108
|
+
rendering: ["/^render.+$/", "render"],
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
"react/jsx-wrap-multilines": [
|
|
113
|
+
"error",
|
|
114
|
+
{
|
|
115
|
+
declaration: "parens",
|
|
116
|
+
assignment: "parens",
|
|
117
|
+
return: "parens",
|
|
118
|
+
arrow: "parens",
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
"react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
|
|
122
|
+
"react/jsx-equals-spacing": ["error", "never"],
|
|
123
|
+
"react/jsx-indent": ["error", 2],
|
|
124
|
+
"react/jsx-no-target-blank": "warn",
|
|
125
|
+
"react/no-access-state-in-setstate": "error",
|
|
126
|
+
"react/jsx-filename-extension": ["error", { extensions: [".jsx", ".js", ".tsx", ".ts", ".vue"] }],
|
|
127
|
+
"react/jsx-no-comment-textnodes": "error",
|
|
128
|
+
"react/no-render-return-value": "error",
|
|
129
|
+
"react/require-optimization": "off",
|
|
130
|
+
"react/no-find-dom-node": "error",
|
|
131
|
+
"react/forbid-component-props": "off",
|
|
132
|
+
"react/forbid-elements": "off",
|
|
133
|
+
"react/no-danger-with-children": "error",
|
|
134
|
+
"react/no-unused-prop-types": [
|
|
135
|
+
"error",
|
|
136
|
+
{
|
|
137
|
+
customValidators: [],
|
|
138
|
+
skipShapeProps: true,
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
"react/style-prop-object": "error",
|
|
142
|
+
"react/no-unescaped-entities": "error",
|
|
143
|
+
"react/no-children-prop": "error",
|
|
144
|
+
"react/jsx-tag-spacing": [
|
|
145
|
+
"error",
|
|
146
|
+
{
|
|
147
|
+
closingSlash: "never",
|
|
148
|
+
beforeSelfClosing: "always",
|
|
149
|
+
afterOpening: "never",
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
"react/jsx-space-before-closing": "off",
|
|
153
|
+
"react/no-array-index-key": "warn",
|
|
154
|
+
"react/require-default-props": "off",
|
|
155
|
+
"react/forbid-foreign-prop-types": "off",
|
|
156
|
+
"react/void-dom-elements-no-children": "error",
|
|
157
|
+
"react/default-props-match-prop-types": ["warn", { allowRequiredDefaults: false }],
|
|
158
|
+
"react/no-redundant-should-component-update": "error",
|
|
159
|
+
"react/no-unused-state": "error",
|
|
160
|
+
"react/boolean-prop-naming": "off",
|
|
161
|
+
"react/no-typos": "error",
|
|
162
|
+
"react/jsx-curly-brace-presence": "off",
|
|
163
|
+
"react-hooks/rules-of-hooks": "error",
|
|
164
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
165
|
+
},
|
|
166
|
+
settings: {
|
|
167
|
+
"import/resolver": {
|
|
168
|
+
node: {
|
|
169
|
+
extensions: [".js", ".jsx", ".json"],
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
react: {
|
|
173
|
+
pragma: "React",
|
|
174
|
+
version: "detect",
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
};
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
parser: "@typescript-eslint/parser",
|
|
3
|
+
plugins: ["@typescript-eslint"],
|
|
4
|
+
settings: {
|
|
5
|
+
"import/parsers": {
|
|
6
|
+
"@typescript-eslint/parser": [".ts", ".d.ts"],
|
|
7
|
+
},
|
|
8
|
+
"import/resolver": {
|
|
9
|
+
node: {
|
|
10
|
+
extensions: [".mjs", ".js", ".ts", ".json"],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
"import/extensions": [".js", ".ts", ".mjs"],
|
|
14
|
+
},
|
|
15
|
+
parserOptions: {
|
|
16
|
+
project: "./tsconfig.json",
|
|
17
|
+
createDefaultProgram: true,
|
|
18
|
+
extraFileExtensions: [".vue"],
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
22
|
+
"@typescript-eslint/array-type": ["warn", { default: "array-simple" }],
|
|
23
|
+
"@typescript-eslint/await-thenable": "off",
|
|
24
|
+
"@typescript-eslint/ban-ts-comment": [
|
|
25
|
+
"warn",
|
|
26
|
+
{
|
|
27
|
+
"ts-expect-error": "allow-with-description",
|
|
28
|
+
"ts-ignore": "allow-with-description",
|
|
29
|
+
"ts-nocheck": "allow-with-description",
|
|
30
|
+
"ts-check": "allow-with-description",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
"@typescript-eslint/ban-tslint-comment": "error",
|
|
34
|
+
"@typescript-eslint/ban-types": "warn",
|
|
35
|
+
|
|
36
|
+
"brace-style": "off",
|
|
37
|
+
"@typescript-eslint/brace-style": ["error", "1tbs", { allowSingleLine: true }],
|
|
38
|
+
"@typescript-eslint/class-literal-property-style": ["warn", "fields"],
|
|
39
|
+
"comma-spacing": "off",
|
|
40
|
+
"@typescript-eslint/comma-spacing": ["error", { before: false, after: true }],
|
|
41
|
+
"@typescript-eslint/consistent-type-assertions": [
|
|
42
|
+
"error",
|
|
43
|
+
{
|
|
44
|
+
assertionStyle: "as",
|
|
45
|
+
objectLiteralTypeAssertions: "never",
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
"@typescript-eslint/consistent-type-definitions": ["warn", "interface"],
|
|
49
|
+
"default-param-last": "off",
|
|
50
|
+
"@typescript-eslint/default-param-last": "off",
|
|
51
|
+
"dot-notation": "off",
|
|
52
|
+
"@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
|
|
53
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
54
|
+
"@typescript-eslint/explicit-member-accessibility": ["warn", { accessibility: "no-public" }],
|
|
55
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
56
|
+
"func-call-spacing": "off",
|
|
57
|
+
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
|
58
|
+
indent: "off",
|
|
59
|
+
"@typescript-eslint/indent": [
|
|
60
|
+
"error",
|
|
61
|
+
2,
|
|
62
|
+
{
|
|
63
|
+
SwitchCase: 1,
|
|
64
|
+
VariableDeclarator: 1,
|
|
65
|
+
outerIIFEBody: 1,
|
|
66
|
+
FunctionDeclaration: {
|
|
67
|
+
parameters: 1,
|
|
68
|
+
body: 1,
|
|
69
|
+
},
|
|
70
|
+
FunctionExpression: {
|
|
71
|
+
parameters: 1,
|
|
72
|
+
body: 1,
|
|
73
|
+
},
|
|
74
|
+
CallExpression: {
|
|
75
|
+
arguments: 1,
|
|
76
|
+
},
|
|
77
|
+
ArrayExpression: 1,
|
|
78
|
+
ObjectExpression: 1,
|
|
79
|
+
ImportDeclaration: 1,
|
|
80
|
+
flatTernaryExpressions: false,
|
|
81
|
+
ignoredNodes: [
|
|
82
|
+
"JSXElement",
|
|
83
|
+
"JSXElement > *",
|
|
84
|
+
"JSXAttribute",
|
|
85
|
+
"JSXIdentifier",
|
|
86
|
+
"JSXNamespacedName",
|
|
87
|
+
"JSXMemberExpression",
|
|
88
|
+
"JSXSpreadAttribute",
|
|
89
|
+
"JSXExpressionContainer",
|
|
90
|
+
"JSXOpeningElement",
|
|
91
|
+
"JSXClosingElement",
|
|
92
|
+
"JSXText",
|
|
93
|
+
"JSXEmptyExpression",
|
|
94
|
+
"JSXSpreadChild",
|
|
95
|
+
],
|
|
96
|
+
ignoreComments: false,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
"init-declarations": "off",
|
|
100
|
+
"@typescript-eslint/init-declarations": "off",
|
|
101
|
+
"keyword-spacing": "off",
|
|
102
|
+
"@typescript-eslint/keyword-spacing": [
|
|
103
|
+
"error",
|
|
104
|
+
{
|
|
105
|
+
before: true,
|
|
106
|
+
after: true,
|
|
107
|
+
overrides: {
|
|
108
|
+
return: { after: true },
|
|
109
|
+
throw: { after: true },
|
|
110
|
+
case: { after: true },
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
"lines-between-class-members": "off",
|
|
115
|
+
"@typescript-eslint/lines-between-class-members": "off",
|
|
116
|
+
"@typescript-eslint/member-delimiter-style": "error",
|
|
117
|
+
"@typescript-eslint/member-ordering": [
|
|
118
|
+
"warn",
|
|
119
|
+
{
|
|
120
|
+
default: [
|
|
121
|
+
"public-static-field",
|
|
122
|
+
"protected-static-field",
|
|
123
|
+
"private-static-field",
|
|
124
|
+
"static-field",
|
|
125
|
+
"public-static-method",
|
|
126
|
+
"protected-static-method",
|
|
127
|
+
"private-static-method",
|
|
128
|
+
"static-method",
|
|
129
|
+
"public-instance-field",
|
|
130
|
+
"protected-instance-field",
|
|
131
|
+
"private-instance-field",
|
|
132
|
+
"public-field",
|
|
133
|
+
"protected-field",
|
|
134
|
+
"private-field",
|
|
135
|
+
"instance-field",
|
|
136
|
+
"field",
|
|
137
|
+
"constructor",
|
|
138
|
+
"public-instance-method",
|
|
139
|
+
"protected-instance-method",
|
|
140
|
+
"private-instance-method",
|
|
141
|
+
"public-method",
|
|
142
|
+
"protected-method",
|
|
143
|
+
"private-method",
|
|
144
|
+
"instance-method",
|
|
145
|
+
"method",
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
"@typescript-eslint/method-signature-style": ["warn", "property"],
|
|
150
|
+
camelcase: "off",
|
|
151
|
+
"@typescript-eslint/camelcase": "off",
|
|
152
|
+
"@typescript-eslint/naming-convention": "off",
|
|
153
|
+
"no-array-constructor": "off",
|
|
154
|
+
"@typescript-eslint/no-array-constructor": "error",
|
|
155
|
+
"@typescript-eslint/no-base-to-string": "off",
|
|
156
|
+
"@typescript-eslint/no-confusing-non-null-assertion": "warn",
|
|
157
|
+
"no-dupe-class-members": "off",
|
|
158
|
+
"@typescript-eslint/no-dupe-class-members": "error",
|
|
159
|
+
"@typescript-eslint/no-dynamic-delete": "off",
|
|
160
|
+
"no-empty-function": "off",
|
|
161
|
+
"@typescript-eslint/no-empty-function": [
|
|
162
|
+
"error",
|
|
163
|
+
{
|
|
164
|
+
allow: ["arrowFunctions", "functions", "methods"],
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
"@typescript-eslint/no-empty-interface": "warn",
|
|
168
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
169
|
+
"@typescript-eslint/no-extra-non-null-assertion": "off",
|
|
170
|
+
"no-extra-parens": "off",
|
|
171
|
+
"@typescript-eslint/no-extra-parens": "off",
|
|
172
|
+
"no-extra-semi": "off",
|
|
173
|
+
"@typescript-eslint/no-extra-semi": "error",
|
|
174
|
+
"@typescript-eslint/no-extraneous-class": "off",
|
|
175
|
+
"@typescript-eslint/no-floating-promises": "off",
|
|
176
|
+
"@typescript-eslint/no-for-in-array": "off",
|
|
177
|
+
"@typescript-eslint/no-implied-eval": "off",
|
|
178
|
+
"@typescript-eslint/no-inferrable-types": "warn",
|
|
179
|
+
"no-invalid-this": "off",
|
|
180
|
+
"@typescript-eslint/no-invalid-this": "off",
|
|
181
|
+
"@typescript-eslint/no-invalid-void-type": "error",
|
|
182
|
+
"no-loss-of-precision": "off",
|
|
183
|
+
"@typescript-eslint/no-loss-of-precision": ["error"],
|
|
184
|
+
"no-magic-numbers": "off",
|
|
185
|
+
"@typescript-eslint/no-magic-numbers": "off",
|
|
186
|
+
"@typescript-eslint/no-misused-new": "off",
|
|
187
|
+
"@typescript-eslint/no-misused-promises": "off",
|
|
188
|
+
"@typescript-eslint/no-namespace": [
|
|
189
|
+
"error",
|
|
190
|
+
{
|
|
191
|
+
allowDeclarations: true,
|
|
192
|
+
allowDefinitionFiles: true,
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
196
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
197
|
+
"@typescript-eslint/no-parameter-properties": "off",
|
|
198
|
+
"@typescript-eslint/no-require-imports": "off",
|
|
199
|
+
"no-shadow": "off",
|
|
200
|
+
"@typescript-eslint/no-shadow": "error",
|
|
201
|
+
"@typescript-eslint/no-this-alias": [
|
|
202
|
+
"warn",
|
|
203
|
+
{
|
|
204
|
+
allowDestructuring: true,
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
"@typescript-eslint/no-throw-literal": "off",
|
|
208
|
+
"@typescript-eslint/no-type-alias": "off",
|
|
209
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
|
|
210
|
+
"@typescript-eslint/no-unnecessary-condition": "off",
|
|
211
|
+
"@typescript-eslint/no-unnecessary-qualifier": "off",
|
|
212
|
+
"@typescript-eslint/no-unnecessary-type-arguments": "off",
|
|
213
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "off",
|
|
214
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
215
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
216
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
217
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
218
|
+
"no-unused-expressions": "off",
|
|
219
|
+
"@typescript-eslint/no-unused-expressions": [
|
|
220
|
+
"error",
|
|
221
|
+
{
|
|
222
|
+
allowShortCircuit: true,
|
|
223
|
+
allowTernary: true,
|
|
224
|
+
allowTaggedTemplates: true,
|
|
225
|
+
},
|
|
226
|
+
],
|
|
227
|
+
"no-unused-vars": "off",
|
|
228
|
+
"@typescript-eslint/no-unused-vars": ["error", { vars: "all", args: "after-used", ignoreRestSiblings: true }],
|
|
229
|
+
"@typescript-eslint/no-unused-vars-experimental": "off",
|
|
230
|
+
"no-use-before-define": "off",
|
|
231
|
+
"@typescript-eslint/no-use-before-define": ["error", { functions: false, classes: false, variables: false }],
|
|
232
|
+
"no-useless-constructor": "off",
|
|
233
|
+
"@typescript-eslint/no-useless-constructor": "error",
|
|
234
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
235
|
+
"@typescript-eslint/prefer-as-const": "warn",
|
|
236
|
+
"@typescript-eslint/prefer-for-of": "off",
|
|
237
|
+
"@typescript-eslint/prefer-function-type": "off",
|
|
238
|
+
"@typescript-eslint/prefer-includes": "off",
|
|
239
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
240
|
+
"@typescript-eslint/prefer-nullish-coalescing": "off",
|
|
241
|
+
"@typescript-eslint/prefer-optional-chain": "warn",
|
|
242
|
+
"@typescript-eslint/prefer-readonly": "off",
|
|
243
|
+
"@typescript-eslint/prefer-readonly-parameter-types": "off",
|
|
244
|
+
"@typescript-eslint/prefer-reduce-type-parameter": "off",
|
|
245
|
+
"@typescript-eslint/prefer-regexp-exec": "off",
|
|
246
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "off",
|
|
247
|
+
"@typescript-eslint/prefer-ts-expect-error": "off",
|
|
248
|
+
"@typescript-eslint/promise-function-async": "off",
|
|
249
|
+
quotes: "off",
|
|
250
|
+
"@typescript-eslint/quotes": ["error", "double", { avoidEscape: true }],
|
|
251
|
+
"require-await": "off",
|
|
252
|
+
"@typescript-eslint/require-await": "off",
|
|
253
|
+
"@typescript-eslint/restrict-plus-operands": "warn",
|
|
254
|
+
"@typescript-eslint/restrict-template-expressions": "off",
|
|
255
|
+
"no-return-await": "off",
|
|
256
|
+
"@typescript-eslint/return-await": "off",
|
|
257
|
+
semi: "off",
|
|
258
|
+
"@typescript-eslint/semi": ["error", "always"],
|
|
259
|
+
"space-before-function-paren": "off",
|
|
260
|
+
"@typescript-eslint/space-before-function-paren": [
|
|
261
|
+
"error",
|
|
262
|
+
{
|
|
263
|
+
anonymous: "always",
|
|
264
|
+
named: "never",
|
|
265
|
+
asyncArrow: "always",
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
269
|
+
"@typescript-eslint/switch-exhaustiveness-check": "off",
|
|
270
|
+
"@typescript-eslint/triple-slash-reference": [
|
|
271
|
+
"error",
|
|
272
|
+
{
|
|
273
|
+
path: "never",
|
|
274
|
+
types: "always",
|
|
275
|
+
lib: "always",
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
"@typescript-eslint/type-annotation-spacing": "error",
|
|
279
|
+
"@typescript-eslint/typedef": [
|
|
280
|
+
"error",
|
|
281
|
+
{
|
|
282
|
+
arrayDestructuring: false,
|
|
283
|
+
arrowParameter: false,
|
|
284
|
+
memberVariableDeclaration: false,
|
|
285
|
+
objectDestructuring: false,
|
|
286
|
+
parameter: false,
|
|
287
|
+
propertyDeclaration: true,
|
|
288
|
+
variableDeclaration: false,
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
"@typescript-eslint/unbound-method": "off",
|
|
292
|
+
"@typescript-eslint/unified-signatures": "warn",
|
|
293
|
+
},
|
|
294
|
+
overrides: [
|
|
295
|
+
{
|
|
296
|
+
files: ["*.ts", "*.tsx"],
|
|
297
|
+
rules: {
|
|
298
|
+
"no-undef": "off",
|
|
299
|
+
"import/no-unresolved": "off",
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
};
|
package/rules/uni-app.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
globals: {
|
|
3
|
+
App: true,
|
|
4
|
+
Page: true,
|
|
5
|
+
Component: true,
|
|
6
|
+
Behavior: true,
|
|
7
|
+
getApp: true,
|
|
8
|
+
getCurrentPages: true,
|
|
9
|
+
plus: true,
|
|
10
|
+
uni: true,
|
|
11
|
+
Vue: true,
|
|
12
|
+
wx: true,
|
|
13
|
+
my: true,
|
|
14
|
+
swan: true,
|
|
15
|
+
tt: true,
|
|
16
|
+
qh: true,
|
|
17
|
+
qa: true,
|
|
18
|
+
xhs: true,
|
|
19
|
+
HWH5: true,
|
|
20
|
+
weex: true,
|
|
21
|
+
__id__: true,
|
|
22
|
+
__uniConfig: true,
|
|
23
|
+
__uniRoutes: true,
|
|
24
|
+
__registerPage: true,
|
|
25
|
+
UniViewJSBridge: true,
|
|
26
|
+
UniServiceJSBridge: true,
|
|
27
|
+
__DEV__: true,
|
|
28
|
+
__VIEW__: true,
|
|
29
|
+
__PLATFORM__: true,
|
|
30
|
+
__VERSION__: true,
|
|
31
|
+
__GLOBAL__: true,
|
|
32
|
+
__PLATFORM_TITLE__: true,
|
|
33
|
+
__PLATFORM_PREFIX__: true,
|
|
34
|
+
it: true,
|
|
35
|
+
describe: true,
|
|
36
|
+
expect: true,
|
|
37
|
+
},
|
|
38
|
+
};
|
package/rules/vue.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
parser: "vue-eslint-parser",
|
|
3
|
+
plugins: ["vue"],
|
|
4
|
+
rules: {
|
|
5
|
+
"vue/comment-directive": "error",
|
|
6
|
+
"vue/jsx-uses-vars": "error",
|
|
7
|
+
"vue/no-shared-component-data": "error",
|
|
8
|
+
"vue/require-prop-type-constructor": "error",
|
|
9
|
+
"vue/require-valid-default-prop": "error",
|
|
10
|
+
"vue/require-v-for-key": "error",
|
|
11
|
+
"vue/no-use-v-if-with-v-for": "warn",
|
|
12
|
+
"vue/no-async-in-computed-properties": "error",
|
|
13
|
+
"vue/no-dupe-keys": "error",
|
|
14
|
+
"vue/no-duplicate-attributes": "error",
|
|
15
|
+
"vue/no-parsing-error": [
|
|
16
|
+
"error",
|
|
17
|
+
{
|
|
18
|
+
"x-invalid-end-tag": false,
|
|
19
|
+
"invalid-first-character-of-tag-name": false,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
"vue/no-reserved-keys": "error",
|
|
23
|
+
"vue/no-side-effects-in-computed-properties": "error",
|
|
24
|
+
"vue/no-template-key": "warn",
|
|
25
|
+
"vue/no-textarea-mustache": "error",
|
|
26
|
+
"vue/no-unused-components": "warn",
|
|
27
|
+
"vue/no-unused-vars": "warn",
|
|
28
|
+
"vue/require-component-is": "warn",
|
|
29
|
+
"vue/require-render-return": "error",
|
|
30
|
+
"vue/return-in-computed-property": "error",
|
|
31
|
+
"vue/use-v-on-exact": "error",
|
|
32
|
+
"vue/valid-template-root": "error",
|
|
33
|
+
"vue/valid-v-bind": "error",
|
|
34
|
+
"vue/valid-v-cloak": "error",
|
|
35
|
+
"vue/valid-v-else-if": "error",
|
|
36
|
+
"vue/valid-v-else": "error",
|
|
37
|
+
"vue/valid-v-for": "error",
|
|
38
|
+
"vue/valid-v-html": "error",
|
|
39
|
+
"vue/valid-v-if": "error",
|
|
40
|
+
"vue/valid-v-model": "error",
|
|
41
|
+
"vue/valid-v-on": "error",
|
|
42
|
+
"vue/valid-v-once": "error",
|
|
43
|
+
"vue/valid-v-pre": "error",
|
|
44
|
+
"vue/valid-v-show": "error",
|
|
45
|
+
},
|
|
46
|
+
};
|