@umijs/lint 4.0.0-canary.202200505.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.
Files changed (40) hide show
  1. package/README.md +3 -0
  2. package/compiled/@rushstack/eslint-patch/LICENSE +24 -0
  3. package/compiled/@rushstack/eslint-patch/lib/modern-module-resolution.js +216 -0
  4. package/compiled/@rushstack/eslint-patch/package.json +1 -0
  5. package/compiled/postcss-less/LICENSE +24 -0
  6. package/compiled/postcss-less/index.js +1 -0
  7. package/compiled/postcss-less/package.json +1 -0
  8. package/compiled/stylelint-config-css-modules/index.js +1 -0
  9. package/compiled/stylelint-config-css-modules/package.json +1 -0
  10. package/compiled/stylelint-config-prettier/LICENSE +22 -0
  11. package/compiled/stylelint-config-prettier/index.js +1 -0
  12. package/compiled/stylelint-config-prettier/package.json +1 -0
  13. package/compiled/stylelint-declaration-block-no-ignored-properties/LICENSE +21 -0
  14. package/compiled/stylelint-declaration-block-no-ignored-properties/index.js +75 -0
  15. package/compiled/stylelint-declaration-block-no-ignored-properties/package.json +1 -0
  16. package/dist/config/eslint/index.d.ts +1 -0
  17. package/dist/config/eslint/index.js +70 -0
  18. package/dist/config/eslint/legacy.d.ts +1 -0
  19. package/dist/config/eslint/legacy.js +58 -0
  20. package/dist/config/eslint/rules/fabric.d.ts +86 -0
  21. package/dist/config/eslint/rules/fabric.js +90 -0
  22. package/dist/config/eslint/rules/recommended.d.ts +98 -0
  23. package/dist/config/eslint/rules/recommended.js +113 -0
  24. package/dist/config/eslint/setup.d.ts +0 -0
  25. package/dist/config/eslint/setup.js +3 -0
  26. package/dist/config/stylelint/index.d.ts +0 -0
  27. package/dist/config/stylelint/index.js +34 -0
  28. package/dist/index.d.ts +4 -0
  29. package/dist/index.js +31 -0
  30. package/dist/linter/base.d.ts +27 -0
  31. package/dist/linter/base.js +51 -0
  32. package/dist/linter/eslint.d.ts +9 -0
  33. package/dist/linter/eslint.js +23 -0
  34. package/dist/linter/index.d.ts +2 -0
  35. package/dist/linter/index.js +10 -0
  36. package/dist/linter/stylelint.d.ts +9 -0
  37. package/dist/linter/stylelint.js +26 -0
  38. package/dist/types.d.ts +10 -0
  39. package/dist/types.js +2 -0
  40. package/package.json +64 -0
@@ -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;
@@ -0,0 +1,9 @@
1
+ import type { ILintArgs } from '../types';
2
+ import BaseLinter from './base';
3
+ /**
4
+ * linter for drive eslint
5
+ */
6
+ export default class Eslinter extends BaseLinter {
7
+ linter: string;
8
+ getRunArgs(args: ILintArgs): string[];
9
+ }
@@ -0,0 +1,23 @@
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 base_1 = __importDefault(require("./base"));
7
+ /**
8
+ * linter for drive eslint
9
+ */
10
+ class Eslinter extends base_1.default {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.linter = 'eslint';
14
+ }
15
+ getRunArgs(args) {
16
+ return [
17
+ '--quiet',
18
+ ...(args.fix ? ['--fix'] : []),
19
+ ...args._,
20
+ ];
21
+ }
22
+ }
23
+ exports.default = Eslinter;
@@ -0,0 +1,2 @@
1
+ export { default as EsLinter } from './eslint';
2
+ export { default as StyleLinter } from './stylelint';
@@ -0,0 +1,10 @@
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
+ exports.StyleLinter = exports.EsLinter = void 0;
7
+ var eslint_1 = require("./eslint");
8
+ Object.defineProperty(exports, "EsLinter", { enumerable: true, get: function () { return __importDefault(eslint_1).default; } });
9
+ var stylelint_1 = require("./stylelint");
10
+ Object.defineProperty(exports, "StyleLinter", { enumerable: true, get: function () { return __importDefault(stylelint_1).default; } });
@@ -0,0 +1,9 @@
1
+ import type { ILintArgs } from '../types';
2
+ import BaseLinter from './base';
3
+ /**
4
+ * linter for drive stylelint
5
+ */
6
+ export default class StyleLinter extends BaseLinter {
7
+ linter: string;
8
+ getRunArgs(args: ILintArgs): string[];
9
+ }
@@ -0,0 +1,26 @@
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 base_1 = __importDefault(require("./base"));
7
+ /**
8
+ * linter for drive stylelint
9
+ */
10
+ class StyleLinter extends base_1.default {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.linter = 'stylelint';
14
+ }
15
+ getRunArgs(args) {
16
+ return [
17
+ '--config-basedir',
18
+ this.paths.cwd,
19
+ '--quiet',
20
+ '--allow-empty-input',
21
+ ...(args.fix ? ['--fix'] : []),
22
+ ...args._,
23
+ ];
24
+ }
25
+ }
26
+ exports.default = StyleLinter;
@@ -0,0 +1,10 @@
1
+ export interface ILinterOpts {
2
+ cwd: string;
3
+ }
4
+ export interface ILintArgs {
5
+ _: string[];
6
+ fix?: boolean;
7
+ eslintOnly?: boolean;
8
+ stylelintOnly?: boolean;
9
+ cssinjs?: boolean;
10
+ }
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@umijs/lint",
3
+ "version": "4.0.0-canary.202200505.1",
4
+ "description": "@umijs/lint",
5
+ "homepage": "https://github.com/umijs/umi-next/tree/master/packages/lint#readme",
6
+ "bugs": "https://github.com/umijs/umi-next/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/umijs/umi-next"
10
+ },
11
+ "license": "MIT",
12
+ "main": "dist/index.js",
13
+ "types": "dist/index.d.ts",
14
+ "files": [
15
+ "compiled",
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "pnpm tsc",
20
+ "build:deps": "umi-scripts bundleDeps",
21
+ "dev": "pnpm build -- --watch"
22
+ },
23
+ "dependencies": {
24
+ "@babel/core": "7.17.9",
25
+ "@babel/eslint-parser": "7.17.0",
26
+ "@stylelint/postcss-css-in-js": "^0.37.2",
27
+ "@typescript-eslint/eslint-plugin": "5.20.0",
28
+ "@typescript-eslint/parser": "5.20.0",
29
+ "@umijs/babel-preset-umi": "4.0.0-canary.202200505.1",
30
+ "eslint-plugin-jest": "26.1.4",
31
+ "eslint-plugin-react": "7.29.4",
32
+ "eslint-plugin-react-hooks": "4.4.0",
33
+ "postcss": "^8.4.12",
34
+ "postcss-syntax": "0.36.2",
35
+ "stylelint-config-standard": "25.0.0"
36
+ },
37
+ "devDependencies": {
38
+ "@rushstack/eslint-patch": "1.1.2",
39
+ "postcss-less": "6.0.0",
40
+ "stylelint-config-css-modules": "4.1.0",
41
+ "stylelint-config-prettier": "9.0.3",
42
+ "stylelint-declaration-block-no-ignored-properties": "2.5.0"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "authors": [
48
+ "chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
49
+ ],
50
+ "compiledConfig": {
51
+ "deps": [
52
+ "postcss-less",
53
+ "stylelint-config-css-modules",
54
+ "stylelint-config-prettier",
55
+ "stylelint-declaration-block-no-ignored-properties"
56
+ ],
57
+ "excludeDtsDeps": [
58
+ "postcss-less",
59
+ "stylelint-config-css-modules",
60
+ "stylelint-config-prettier",
61
+ "stylelint-declaration-block-no-ignored-properties"
62
+ ]
63
+ }
64
+ }