@umijs/lint 4.0.0-rc.11

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.
Files changed (37) hide show
  1. package/README.md +3 -0
  2. package/compiled/postcss-less/LICENSE +24 -0
  3. package/compiled/postcss-less/index.js +1 -0
  4. package/compiled/postcss-less/package.json +1 -0
  5. package/compiled/stylelint-config-css-modules/index.js +1 -0
  6. package/compiled/stylelint-config-css-modules/package.json +1 -0
  7. package/compiled/stylelint-config-prettier/LICENSE +22 -0
  8. package/compiled/stylelint-config-prettier/index.js +1 -0
  9. package/compiled/stylelint-config-prettier/package.json +1 -0
  10. package/compiled/stylelint-declaration-block-no-ignored-properties/LICENSE +21 -0
  11. package/compiled/stylelint-declaration-block-no-ignored-properties/index.js +75 -0
  12. package/compiled/stylelint-declaration-block-no-ignored-properties/package.json +1 -0
  13. package/dist/config/eslint/index.d.ts +1 -0
  14. package/dist/config/eslint/index.js +60 -0
  15. package/dist/config/eslint/legacy.d.ts +1 -0
  16. package/dist/config/eslint/legacy.js +58 -0
  17. package/dist/config/eslint/rules/fabric.d.ts +86 -0
  18. package/dist/config/eslint/rules/fabric.js +90 -0
  19. package/dist/config/eslint/rules/recommended.d.ts +93 -0
  20. package/dist/config/eslint/rules/recommended.js +109 -0
  21. package/dist/config/eslint/setup.d.ts +0 -0
  22. package/dist/config/eslint/setup.js +3 -0
  23. package/dist/config/stylelint/index.d.ts +0 -0
  24. package/dist/config/stylelint/index.js +34 -0
  25. package/dist/index.d.ts +4 -0
  26. package/dist/index.js +29 -0
  27. package/dist/linter/base.d.ts +27 -0
  28. package/dist/linter/base.js +51 -0
  29. package/dist/linter/eslint.d.ts +9 -0
  30. package/dist/linter/eslint.js +23 -0
  31. package/dist/linter/index.d.ts +2 -0
  32. package/dist/linter/index.js +10 -0
  33. package/dist/linter/stylelint.d.ts +9 -0
  34. package/dist/linter/stylelint.js +26 -0
  35. package/dist/types.d.ts +10 -0
  36. package/dist/types.js +2 -0
  37. package/package.json +64 -0
@@ -0,0 +1 @@
1
+ {"name":"stylelint-declaration-block-no-ignored-properties","author":{"name":"Krister Kari","url":"https://github.com/kristerkari/"},"license":"MIT"}
@@ -0,0 +1 @@
1
+ import './setup';
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const recommended_1 = __importStar(require("./rules/recommended"));
27
+ require("./setup");
28
+ module.exports = {
29
+ parser: '@babel/eslint-parser',
30
+ plugins: ['react', 'react-hooks', 'jest'],
31
+ settings: {
32
+ react: {
33
+ version: 'detect',
34
+ },
35
+ },
36
+ env: {
37
+ browser: true,
38
+ node: true,
39
+ es2022: true,
40
+ jest: true,
41
+ },
42
+ rules: recommended_1.default,
43
+ overrides: [
44
+ {
45
+ parser: '@typescript-eslint/parser',
46
+ plugins: ['@typescript-eslint/eslint-plugin'],
47
+ files: ['**/*.{ts,tsx}'],
48
+ rules: recommended_1.typescript,
49
+ },
50
+ ],
51
+ parserOptions: {
52
+ ecmaFeatures: {
53
+ jsx: true,
54
+ },
55
+ babelOptions: {
56
+ presets: [require.resolve('@umijs/babel-preset-umi')],
57
+ },
58
+ requireConfigFile: false,
59
+ },
60
+ };
@@ -0,0 +1 @@
1
+ import './setup';
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const fabric_1 = __importStar(require("./rules/fabric"));
27
+ require("./setup");
28
+ module.exports = {
29
+ extends: ['prettier', 'plugin:react/recommended'],
30
+ parser: '@babel/eslint-parser',
31
+ plugins: ['react', 'react-hooks'],
32
+ env: {
33
+ browser: true,
34
+ node: true,
35
+ es6: true,
36
+ mocha: true,
37
+ jest: true,
38
+ jasmine: true,
39
+ },
40
+ rules: fabric_1.default,
41
+ overrides: [
42
+ {
43
+ files: ['**/*.{ts,tsx}'],
44
+ parser: '@typescript-eslint/parser',
45
+ rules: fabric_1.typescript,
46
+ extends: ['prettier', 'plugin:@typescript-eslint/recommended'],
47
+ },
48
+ ],
49
+ parserOptions: {
50
+ ecmaFeatures: {
51
+ jsx: true,
52
+ },
53
+ babelOptions: {
54
+ presets: [require.resolve('@umijs/babel-preset-umi')],
55
+ },
56
+ requireConfigFile: false,
57
+ },
58
+ };
@@ -0,0 +1,86 @@
1
+ /**
2
+ * legay enabled/disabled rules from @umijs/fabric tsEslintConfig
3
+ * @see https://github.com/umijs/fabric/blob/master/src/tsEslintConfig.ts
4
+ */
5
+ export declare const typescript: {
6
+ 'no-dupe-class-members': number;
7
+ 'no-redeclare': number;
8
+ 'no-undef': number;
9
+ 'no-unused-vars': number;
10
+ '@typescript-eslint/adjacent-overload-signatures': number;
11
+ '@typescript-eslint/array-type': number;
12
+ '@typescript-eslint/await-thenable': number;
13
+ '@typescript-eslint/ban-ts-comment': number;
14
+ '@typescript-eslint/ban-types': number;
15
+ '@typescript-eslint/consistent-indexed-object-style': number;
16
+ '@typescript-eslint/consistent-type-imports': number;
17
+ '@typescript-eslint/dot-notation': number;
18
+ '@typescript-eslint/method-signature-style': number;
19
+ '@typescript-eslint/no-array-constructor': number;
20
+ '@typescript-eslint/no-confusing-non-null-assertion': number;
21
+ '@typescript-eslint/no-dupe-class-members': number;
22
+ '@typescript-eslint/no-empty-function': number;
23
+ '@typescript-eslint/no-empty-interface': number;
24
+ '@typescript-eslint/no-explicit-any': number;
25
+ '@typescript-eslint/no-extra-non-null-assertion': number;
26
+ '@typescript-eslint/no-floating-promises': number;
27
+ '@typescript-eslint/no-implied-eval': number;
28
+ '@typescript-eslint/no-inferrable-types': number;
29
+ '@typescript-eslint/no-invalid-this': number;
30
+ '@typescript-eslint/no-loop-func': number;
31
+ '@typescript-eslint/no-loss-of-precision': number;
32
+ '@typescript-eslint/no-misused-promises': number;
33
+ '@typescript-eslint/no-namespace': number;
34
+ '@typescript-eslint/no-non-null-assertion': number;
35
+ '@typescript-eslint/no-parameter-properties': number;
36
+ '@typescript-eslint/no-redeclare': number;
37
+ '@typescript-eslint/no-shadow': number;
38
+ '@typescript-eslint/no-throw-literal': number;
39
+ '@typescript-eslint/no-unnecessary-type-assertion': number;
40
+ '@typescript-eslint/no-unnecessary-type-constraint': number;
41
+ '@typescript-eslint/no-unsafe-assignment': number;
42
+ '@typescript-eslint/no-unsafe-call': number;
43
+ '@typescript-eslint/no-unsafe-member-access': number;
44
+ '@typescript-eslint/no-unsafe-return': number;
45
+ '@typescript-eslint/no-unused-expressions': number;
46
+ '@typescript-eslint/no-unused-vars': (string | {
47
+ vars: string;
48
+ args: string;
49
+ ignoreRestSiblings: boolean;
50
+ })[];
51
+ '@typescript-eslint/no-use-before-define': (string | {
52
+ functions: boolean;
53
+ classes: boolean;
54
+ variables: boolean;
55
+ typedefs: boolean;
56
+ })[];
57
+ '@typescript-eslint/no-useless-constructor': number;
58
+ '@typescript-eslint/no-var-requires': number;
59
+ '@typescript-eslint/prefer-as-const': number;
60
+ '@typescript-eslint/prefer-namespace-keyword': number;
61
+ '@typescript-eslint/require-await': number;
62
+ '@typescript-eslint/restrict-plus-operands': number;
63
+ '@typescript-eslint/restrict-template-expressions': number;
64
+ '@typescript-eslint/switch-exhaustiveness-check': number;
65
+ '@typescript-eslint/type-annotation-spacing': number;
66
+ '@typescript-eslint/typedef': number;
67
+ '@typescript-eslint/unbound-method': number;
68
+ '@typescript-eslint/unified-signatures': number;
69
+ };
70
+ declare const _default: {
71
+ 'no-param-reassign': number;
72
+ 'no-prototype-builtins': number;
73
+ 'react/display-name': number;
74
+ 'react/jsx-key': number;
75
+ 'react/no-array-index-key': number;
76
+ 'react/prop-types': number;
77
+ 'react/react-in-jsx-scope': number;
78
+ 'react/self-closing-comp': number;
79
+ 'react-hooks/exhaustive-deps': number;
80
+ 'react-hooks/rules-of-hooks': number;
81
+ };
82
+ /**
83
+ * legay enabled/disabled rules from @umijs/fabric
84
+ * @see https://github.com/umijs/fabric/blob/master/src/eslint.ts#L54
85
+ */
86
+ export default _default;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.typescript = void 0;
4
+ /**
5
+ * legay enabled/disabled rules from @umijs/fabric tsEslintConfig
6
+ * @see https://github.com/umijs/fabric/blob/master/src/tsEslintConfig.ts
7
+ */
8
+ exports.typescript = {
9
+ // eslint built-in rules
10
+ 'no-dupe-class-members': 0,
11
+ 'no-redeclare': 0,
12
+ 'no-undef': 0,
13
+ 'no-unused-vars': 0,
14
+ // @typescript-eslint rules
15
+ '@typescript-eslint/adjacent-overload-signatures': 0,
16
+ '@typescript-eslint/array-type': 2,
17
+ '@typescript-eslint/await-thenable': 0,
18
+ '@typescript-eslint/ban-ts-comment': 0,
19
+ '@typescript-eslint/ban-types': 1,
20
+ '@typescript-eslint/consistent-indexed-object-style': 1,
21
+ '@typescript-eslint/consistent-type-imports': 1,
22
+ '@typescript-eslint/dot-notation': 1,
23
+ '@typescript-eslint/method-signature-style': 2,
24
+ '@typescript-eslint/no-array-constructor': 0,
25
+ '@typescript-eslint/no-confusing-non-null-assertion': 2,
26
+ '@typescript-eslint/no-dupe-class-members': 2,
27
+ '@typescript-eslint/no-empty-function': 0,
28
+ '@typescript-eslint/no-empty-interface': 1,
29
+ '@typescript-eslint/no-explicit-any': 0,
30
+ '@typescript-eslint/no-extra-non-null-assertion': 0,
31
+ '@typescript-eslint/no-floating-promises': 0,
32
+ '@typescript-eslint/no-implied-eval': 0,
33
+ '@typescript-eslint/no-inferrable-types': 0,
34
+ '@typescript-eslint/no-invalid-this': 1,
35
+ '@typescript-eslint/no-loop-func': 2,
36
+ '@typescript-eslint/no-loss-of-precision': 0,
37
+ '@typescript-eslint/no-misused-promises': 0,
38
+ '@typescript-eslint/no-namespace': 1,
39
+ '@typescript-eslint/no-non-null-assertion': 0,
40
+ '@typescript-eslint/no-parameter-properties': 2,
41
+ '@typescript-eslint/no-redeclare': 2,
42
+ '@typescript-eslint/no-shadow': 2,
43
+ '@typescript-eslint/no-throw-literal': 2,
44
+ '@typescript-eslint/no-unnecessary-type-assertion': 0,
45
+ '@typescript-eslint/no-unnecessary-type-constraint': 0,
46
+ '@typescript-eslint/no-unsafe-assignment': 0,
47
+ '@typescript-eslint/no-unsafe-call': 0,
48
+ '@typescript-eslint/no-unsafe-member-access': 0,
49
+ '@typescript-eslint/no-unsafe-return': 0,
50
+ '@typescript-eslint/no-unused-expressions': 2,
51
+ '@typescript-eslint/no-unused-vars': [
52
+ 'error',
53
+ { vars: 'all', args: 'after-used', ignoreRestSiblings: true },
54
+ ],
55
+ '@typescript-eslint/no-use-before-define': [
56
+ 'error',
57
+ { functions: false, classes: true, variables: true, typedefs: true },
58
+ ],
59
+ '@typescript-eslint/no-useless-constructor': 2,
60
+ '@typescript-eslint/no-var-requires': 0,
61
+ '@typescript-eslint/prefer-as-const': 0,
62
+ '@typescript-eslint/prefer-namespace-keyword': 0,
63
+ '@typescript-eslint/require-await': 0,
64
+ '@typescript-eslint/restrict-plus-operands': 0,
65
+ '@typescript-eslint/restrict-template-expressions': 0,
66
+ '@typescript-eslint/switch-exhaustiveness-check': 2,
67
+ '@typescript-eslint/type-annotation-spacing': 2,
68
+ '@typescript-eslint/typedef': 2,
69
+ '@typescript-eslint/unbound-method': 0,
70
+ '@typescript-eslint/unified-signatures': 2,
71
+ };
72
+ /**
73
+ * legay enabled/disabled rules from @umijs/fabric
74
+ * @see https://github.com/umijs/fabric/blob/master/src/eslint.ts#L54
75
+ */
76
+ exports.default = {
77
+ // eslint built-in rules
78
+ 'no-param-reassign': 2,
79
+ 'no-prototype-builtins': 0,
80
+ // eslint-plugin-react rules
81
+ 'react/display-name': 0,
82
+ 'react/jsx-key': 1,
83
+ 'react/no-array-index-key': 1,
84
+ 'react/prop-types': 0,
85
+ 'react/react-in-jsx-scope': 0,
86
+ 'react/self-closing-comp': 1,
87
+ // eslint-pluginr-react-hooks rules
88
+ 'react-hooks/exhaustive-deps': 1,
89
+ 'react-hooks/rules-of-hooks': 2,
90
+ };
@@ -0,0 +1,93 @@
1
+ declare const _default: {
2
+ 'array-callback-return': number;
3
+ eqeqeq: number;
4
+ 'for-direction': number;
5
+ 'guard-for-in': number;
6
+ 'no-async-promise-executor': number;
7
+ 'no-case-declarations': number;
8
+ 'no-debugger': number;
9
+ 'no-delete-var': number;
10
+ 'no-dupe-else-if': number;
11
+ 'no-duplicate-case': number;
12
+ 'no-eval': number;
13
+ 'no-ex-assign': number;
14
+ 'no-global-assign': number;
15
+ 'no-invalid-regexp': number;
16
+ 'no-native-reassign': number;
17
+ 'no-param-reassign': number;
18
+ 'no-promise-executor-return': number;
19
+ 'no-self-assign': number;
20
+ 'no-self-compare': number;
21
+ 'no-shadow-restricted-names': number;
22
+ 'no-sparse-arrays': number;
23
+ 'no-unsafe-finally': number;
24
+ 'no-unused-labels': number;
25
+ 'no-useless-catch': number;
26
+ 'no-useless-escape': number;
27
+ 'no-var': number;
28
+ 'no-with': number;
29
+ 'require-yield': number;
30
+ 'use-isnan': number;
31
+ 'react/button-has-type': number;
32
+ 'react/jsx-key': number;
33
+ 'react/jsx-no-comment-textnodes': number;
34
+ 'react/jsx-no-duplicate-props': number;
35
+ 'react/jsx-no-target-blank': number;
36
+ 'react/jsx-no-undef': number;
37
+ 'react/jsx-uses-react': number;
38
+ 'react/jsx-uses-vars': number;
39
+ 'react/no-children-prop': number;
40
+ 'react/no-danger-with-children': number;
41
+ 'react/no-deprecated': number;
42
+ 'react/no-direct-mutation-state': number;
43
+ 'react/no-find-dom-node': number;
44
+ 'react/no-is-mounted': number;
45
+ 'react/no-string-refs': number;
46
+ 'react/no-render-return-value': number;
47
+ 'react/no-unescaped-entities': number;
48
+ 'react/no-unknown-property': number;
49
+ 'react/require-render-return': number;
50
+ 'jest/no-conditional-expect': number;
51
+ 'jest/no-deprecated-functions': number;
52
+ 'jest/no-export': number;
53
+ 'jest/no-focused-tests': number;
54
+ 'jest/no-identical-title': number;
55
+ 'jest/no-interpolation-in-snapshots': number;
56
+ 'jest/no-jasmine-globals': number;
57
+ 'jest/no-jest-import': number;
58
+ 'jest/no-mocks-import': number;
59
+ 'jest/no-standalone-expect': number;
60
+ 'jest/valid-describe-callback': number;
61
+ 'jest/valid-expect-in-promise': number;
62
+ 'jest/valid-expect': number;
63
+ 'jest/valid-title': number;
64
+ 'react-hooks/rules-of-hooks': number;
65
+ };
66
+ /**
67
+ * recommended enabled/disabled rules for umi project
68
+ * @note base on recommended rule set from loaded eslint plugins
69
+ */
70
+ export default _default;
71
+ /**
72
+ * recommended enabled/disabled rules for typescript umi project
73
+ * @note base on recommended rule set from loaded eslint plugins
74
+ */
75
+ export declare const typescript: {
76
+ '@typescript-eslint/ban-types': number;
77
+ '@typescript-eslint/no-confusing-non-null-assertion': number;
78
+ '@typescript-eslint/no-dupe-class-members': number;
79
+ '@typescript-eslint/no-empty-interface': number;
80
+ '@typescript-eslint/no-for-in-array': number;
81
+ '@typescript-eslint/no-invalid-this': number;
82
+ '@typescript-eslint/no-loop-func': number;
83
+ '@typescript-eslint/no-misused-new': number;
84
+ '@typescript-eslint/no-namespace': number;
85
+ '@typescript-eslint/no-non-null-asserted-optional-chain': number;
86
+ '@typescript-eslint/no-redeclare': number;
87
+ '@typescript-eslint/no-this-alias': number;
88
+ '@typescript-eslint/no-unused-expressions': number;
89
+ '@typescript-eslint/no-unused-vars': number;
90
+ '@typescript-eslint/no-use-before-define': number;
91
+ '@typescript-eslint/no-useless-constructor': number;
92
+ '@typescript-eslint/triple-slash-reference': number;
93
+ };
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.typescript = void 0;
4
+ /**
5
+ * recommended enabled/disabled rules for umi project
6
+ * @note base on recommended rule set from loaded eslint plugins
7
+ */
8
+ exports.default = {
9
+ // eslint built-in rules
10
+ // 不需要返回就用 forEach
11
+ 'array-callback-return': 2,
12
+ // eqeq 可能导致潜在的类型转换问题
13
+ eqeqeq: 2,
14
+ 'for-direction': 2,
15
+ // 不加 hasOwnProperty 判断会多出原型链的内容
16
+ 'guard-for-in': 2,
17
+ 'no-async-promise-executor': 2,
18
+ 'no-case-declarations': 2,
19
+ 'no-debugger': 2,
20
+ 'no-delete-var': 2,
21
+ 'no-dupe-else-if': 2,
22
+ 'no-duplicate-case': 2,
23
+ // eval()可能导致潜在的安全问题
24
+ 'no-eval': 2,
25
+ 'no-ex-assign': 2,
26
+ 'no-global-assign': 2,
27
+ 'no-invalid-regexp': 2,
28
+ // 没必要改 native 变量
29
+ 'no-native-reassign': 2,
30
+ // 修改对象时,会影响原对象;但是有些场景就是有目的
31
+ 'no-param-reassign': 2,
32
+ // return 值无意义,可能会理解为 resolve
33
+ 'no-promise-executor-return': 2,
34
+ 'no-self-assign': 2,
35
+ 'no-self-compare': 2,
36
+ 'no-shadow-restricted-names': 2,
37
+ 'no-sparse-arrays': 2,
38
+ 'no-unsafe-finally': 2,
39
+ 'no-unused-labels': 2,
40
+ 'no-useless-catch': 2,
41
+ 'no-useless-escape': 2,
42
+ 'no-var': 2,
43
+ 'no-with': 2,
44
+ 'require-yield': 2,
45
+ 'use-isnan': 2,
46
+ // config-plugin-react rules
47
+ // button 自带 submit 属性
48
+ 'react/button-has-type': 2,
49
+ 'react/jsx-key': 2,
50
+ 'react/jsx-no-comment-textnodes': 2,
51
+ 'react/jsx-no-duplicate-props': 2,
52
+ 'react/jsx-no-target-blank': 2,
53
+ 'react/jsx-no-undef': 2,
54
+ 'react/jsx-uses-react': 2,
55
+ 'react/jsx-uses-vars': 2,
56
+ 'react/no-children-prop': 2,
57
+ 'react/no-danger-with-children': 2,
58
+ 'react/no-deprecated': 2,
59
+ 'react/no-direct-mutation-state': 2,
60
+ 'react/no-find-dom-node': 2,
61
+ 'react/no-is-mounted': 2,
62
+ 'react/no-string-refs': 2,
63
+ 'react/no-render-return-value': 2,
64
+ 'react/no-unescaped-entities': 2,
65
+ 'react/no-unknown-property': 2,
66
+ 'react/require-render-return': 2,
67
+ // config-plugin-jest rules
68
+ 'jest/no-conditional-expect': 2,
69
+ 'jest/no-deprecated-functions': 2,
70
+ 'jest/no-export': 2,
71
+ 'jest/no-focused-tests': 2,
72
+ 'jest/no-identical-title': 2,
73
+ 'jest/no-interpolation-in-snapshots': 2,
74
+ 'jest/no-jasmine-globals': 2,
75
+ 'jest/no-jest-import': 2,
76
+ 'jest/no-mocks-import': 2,
77
+ 'jest/no-standalone-expect': 2,
78
+ 'jest/valid-describe-callback': 2,
79
+ 'jest/valid-expect-in-promise': 2,
80
+ 'jest/valid-expect': 2,
81
+ 'jest/valid-title': 2,
82
+ // config-plugin-react-hooks rules
83
+ 'react-hooks/rules-of-hooks': 2,
84
+ };
85
+ /**
86
+ * recommended enabled/disabled rules for typescript umi project
87
+ * @note base on recommended rule set from loaded eslint plugins
88
+ */
89
+ exports.typescript = {
90
+ // config-plugin-typescript rules
91
+ '@typescript-eslint/ban-types': 2,
92
+ '@typescript-eslint/no-confusing-non-null-assertion': 2,
93
+ '@typescript-eslint/no-dupe-class-members': 2,
94
+ '@typescript-eslint/no-empty-interface': 2,
95
+ '@typescript-eslint/no-for-in-array': 2,
96
+ '@typescript-eslint/no-invalid-this': 2,
97
+ '@typescript-eslint/no-loop-func': 2,
98
+ '@typescript-eslint/no-misused-new': 2,
99
+ '@typescript-eslint/no-namespace': 2,
100
+ '@typescript-eslint/no-non-null-asserted-optional-chain': 2,
101
+ '@typescript-eslint/no-redeclare': 2,
102
+ '@typescript-eslint/no-this-alias': 2,
103
+ // '@typescript-eslint/no-unsafe-argument': 2,
104
+ '@typescript-eslint/no-unused-expressions': 2,
105
+ '@typescript-eslint/no-unused-vars': 2,
106
+ '@typescript-eslint/no-use-before-define': 2,
107
+ '@typescript-eslint/no-useless-constructor': 2,
108
+ '@typescript-eslint/triple-slash-reference': 2,
109
+ };
File without changes
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // patch eslint plugin resolve logic
3
+ require('@rushstack/eslint-patch/modern-module-resolution');
File without changes
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /**
3
+ * rules migrate from @umijs/fabric/dist/stylelint.js
4
+ * @see https://github.com/umijs/fabric/blob/master/src/stylelint.ts
5
+ */
6
+ module.exports = {
7
+ extends: [
8
+ require.resolve('stylelint-config-standard'),
9
+ require.resolve('../../../compiled/stylelint-config-prettier'),
10
+ require.resolve('../../../compiled/stylelint-config-css-modules'),
11
+ ],
12
+ plugins: [
13
+ require.resolve('../../../compiled/stylelint-declaration-block-no-ignored-properties'),
14
+ ],
15
+ rules: {
16
+ 'no-descending-specificity': null,
17
+ 'function-url-quotes': 'always',
18
+ 'selector-attribute-quotes': 'always',
19
+ 'font-family-no-missing-generic-family-keyword': null,
20
+ 'plugin/declaration-block-no-ignored-properties': true,
21
+ 'unit-no-unknown': [true, { ignoreUnits: ['rpx'] }],
22
+ // webcomponent
23
+ 'selector-type-no-unknown': null,
24
+ 'value-keyword-case': ['lower', { ignoreProperties: ['composes'] }],
25
+ },
26
+ customSyntax: require.resolve('../../../compiled/postcss-less'),
27
+ ignoreFiles: ['node_modules'],
28
+ overrides: [
29
+ {
30
+ files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
31
+ customSyntax: require.resolve('@stylelint/postcss-css-in-js'),
32
+ },
33
+ ],
34
+ };
@@ -0,0 +1,4 @@
1
+ import type { ILintArgs, ILinterOpts } from './types';
2
+ export type { ILintArgs, ILinterOpts };
3
+ declare const _default: (opts: ILinterOpts, args: ILintArgs) => void;
4
+ export default _default;
package/dist/index.js ADDED
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const linter_1 = require("./linter");
4
+ const ES_EXTS = ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'];
5
+ const STYLE_EXTS = [
6
+ '**/*.less',
7
+ '**/*.css',
8
+ '**/*.sass',
9
+ '**/*.scss',
10
+ '**/*.styl',
11
+ ];
12
+ exports.default = (opts, args) => {
13
+ if (!args.eslintOnly) {
14
+ const stylelint = new linter_1.StyleLinter(opts);
15
+ if (!args.cssinjs) {
16
+ for (const suffix of ES_EXTS) {
17
+ args._.unshift('--ignore-pattern', suffix);
18
+ }
19
+ }
20
+ stylelint.run(args);
21
+ }
22
+ if (!args.stylelintOnly) {
23
+ const eslint = new linter_1.EsLinter(opts);
24
+ for (const suffix of STYLE_EXTS) {
25
+ args._.unshift('--ignore-pattern', suffix);
26
+ }
27
+ eslint.run(args);
28
+ }
29
+ };
@@ -0,0 +1,27 @@
1
+ import type { ILintArgs, ILinterOpts } from '../types';
2
+ /**
3
+ * base linter
4
+ */
5
+ export default class BaseLinter {
6
+ /**
7
+ * linter package name
8
+ */
9
+ linter: string;
10
+ /**
11
+ * paths for linter
12
+ */
13
+ paths: Partial<ILinterOpts>;
14
+ constructor({ cwd }: ILinterOpts);
15
+ /**
16
+ * get bin file path for current linter
17
+ */
18
+ getBinPath(): string;
19
+ /**
20
+ * get linter fork args
21
+ */
22
+ getRunArgs(args: ILintArgs): string[];
23
+ /**
24
+ * execute linter
25
+ */
26
+ run(args: ILintArgs): void;
27
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const child_process_1 = require("child_process");
7
+ const path_1 = __importDefault(require("path"));
8
+ /**
9
+ * base linter
10
+ */
11
+ class BaseLinter {
12
+ constructor({ cwd }) {
13
+ /**
14
+ * linter package name
15
+ */
16
+ this.linter = '';
17
+ /**
18
+ * paths for linter
19
+ */
20
+ this.paths = {};
21
+ this.paths.cwd = cwd;
22
+ }
23
+ /**
24
+ * get bin file path for current linter
25
+ */
26
+ getBinPath() {
27
+ try {
28
+ const pkgPath = require.resolve(`${this.linter}/package.json`);
29
+ const pkgContent = require(pkgPath);
30
+ return path_1.default.resolve(path_1.default.dirname(pkgPath), pkgContent.bin[this.linter]);
31
+ }
32
+ catch (e) {
33
+ throw new Error(`${this.linter} not found, please install it first.`);
34
+ }
35
+ }
36
+ /**
37
+ * get linter fork args
38
+ */
39
+ getRunArgs(args) {
40
+ // not implemented
41
+ args;
42
+ return [];
43
+ }
44
+ /**
45
+ * execute linter
46
+ */
47
+ run(args) {
48
+ (0, child_process_1.fork)(this.getBinPath(), this.getRunArgs(args));
49
+ }
50
+ }
51
+ exports.default = BaseLinter;