@utoo/lint 0.2.8 → 0.3.4

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/bin/utoo-lint.js CHANGED
@@ -4,20 +4,20 @@ import { runCli } from "../index.js";
4
4
 
5
5
  if (process.argv[2] === "migrate") {
6
6
  const { runMigrate } = await import("./migrate.js");
7
- process.exit(await runMigrate(process.argv.slice(3)));
8
- }
9
-
10
- let result;
11
- try {
12
- result = runCli(process.argv.slice(2), { stdio: "inherit" });
13
- } catch (error) {
14
- console.error(error.message);
15
- process.exit(1);
16
- }
7
+ process.exitCode = await runMigrate(process.argv.slice(3));
8
+ } else {
9
+ let result;
10
+ try {
11
+ result = runCli(process.argv.slice(2), { stdio: "inherit" });
12
+ } catch (error) {
13
+ console.error(error.message);
14
+ process.exitCode = 1;
15
+ }
17
16
 
18
- if (result.error) {
19
- console.error(`utoo-lint: failed to run native binary: ${result.error.message}`);
20
- process.exit(1);
17
+ if (result?.error) {
18
+ console.error(`utoo-lint: failed to run native binary: ${result.error.message}`);
19
+ process.exitCode = 1;
20
+ } else if (result) {
21
+ process.exitCode = result.status ?? 1;
22
+ }
21
23
  }
22
-
23
- process.exit(result.status ?? 1);
@@ -1,8 +1,60 @@
1
- import type { ConfigObject } from "../index.js";
1
+ import type { ConfigObject, RuleConfig } from "../index.js";
2
+
3
+ export type FrontendRuleId =
4
+ | "no-debugger"
5
+ | "no-alert"
6
+ | "no-console"
7
+ | "no-unused-vars"
8
+ | "prefer-const"
9
+ | "eqeqeq"
10
+ | "use-isnan"
11
+ | "valid-typeof"
12
+ | "no-constant-condition"
13
+ | "no-dupe-keys"
14
+ | "no-duplicate-imports"
15
+ | "no-script-url"
16
+ | "import/first"
17
+ | "import/newline-after-import"
18
+ | "import/no-duplicates"
19
+ | "import/no-self-import"
20
+ | "promise/no-nesting"
21
+ | "react-hooks/rules-of-hooks"
22
+ | "react-hooks/exhaustive-deps"
23
+ | "react/jsx-no-duplicate-props"
24
+ | "react/jsx-key"
25
+ | "react/jsx-no-target-blank"
26
+ | "react/jsx-pascal-case"
27
+ | "react/no-array-index-key"
28
+ | "react/no-children-prop"
29
+ | "react/no-danger"
30
+ | "react/no-danger-with-children"
31
+ | "react/no-find-dom-node"
32
+ | "react/no-forward-ref"
33
+ | "react/no-unstable-nested-components"
34
+ | "react/no-unescaped-entities"
35
+ | "react/void-dom-elements-no-children"
36
+ | "jsx-a11y/aria-props"
37
+ | "jsx-a11y/aria-unsupported-elements"
38
+ | "jsx-a11y/iframe-has-title"
39
+ | "jsx-a11y/img-redundant-alt"
40
+ | "jsx-a11y/no-access-key"
41
+ | "unused-imports/no-unused-imports"
42
+ | "@typescript-eslint/ban-types"
43
+ | "@typescript-eslint/no-unused-vars"
44
+ | "@typescript-eslint/no-use-before-define"
45
+ | "@typescript-eslint/no-shadow"
46
+ | "@typescript-eslint/no-redeclare"
47
+ | "@typescript-eslint/no-require-imports"
48
+ | "@typescript-eslint/consistent-type-assertions"
49
+ | "@typescript-eslint/consistent-type-definitions"
50
+ | "@typescript-eslint/no-empty-interface"
51
+ | "@typescript-eslint/no-non-null-asserted-optional-chain";
2
52
 
3
53
  declare const frontend: ConfigObject & {
4
54
  readonly $schema: string;
5
- readonly rules: NonNullable<ConfigObject["rules"]>;
55
+ readonly files: ["src/**/*.{js,jsx,ts,tsx}"];
56
+ readonly ignores: ["dist", "coverage", "node_modules"];
57
+ readonly rules: Readonly<Record<FrontendRuleId, RuleConfig>>;
6
58
  };
7
59
 
8
60
  export default frontend;
@@ -1,5 +1,7 @@
1
1
  {
2
- "$schema": "https://raw.githubusercontent.com/fireairforce/utoo-lint/main/npm/utoo-lint/schema.json",
2
+ "$schema": "https://raw.githubusercontent.com/utooland/utoo-lint/main/npm/utoo-lint/schema.json",
3
+ "files": ["src/**/*.{js,jsx,ts,tsx}"],
4
+ "ignores": ["dist", "coverage", "node_modules"],
3
5
  "rules": {
4
6
  "no-debugger": "error",
5
7
  "no-alert": "error",
@@ -12,21 +14,34 @@
12
14
  "no-constant-condition": "error",
13
15
  "no-dupe-keys": "error",
14
16
  "no-duplicate-imports": "error",
17
+ "no-script-url": "error",
15
18
  "import/first": "error",
16
19
  "import/newline-after-import": "warn",
17
20
  "import/no-duplicates": "error",
18
21
  "import/no-self-import": "error",
22
+ "promise/no-nesting": "error",
23
+ "react-hooks/rules-of-hooks": "error",
24
+ "react-hooks/exhaustive-deps": "warn",
19
25
  "react/jsx-no-duplicate-props": "error",
26
+ "react/jsx-key": "error",
20
27
  "react/jsx-no-target-blank": "error",
21
28
  "react/jsx-pascal-case": "warn",
29
+ "react/no-array-index-key": "warn",
30
+ "react/no-children-prop": "error",
22
31
  "react/no-danger": "warn",
32
+ "react/no-danger-with-children": "error",
23
33
  "react/no-find-dom-node": "error",
34
+ "react/no-forward-ref": "warn",
35
+ "react/no-unstable-nested-components": "warn",
24
36
  "react/no-unescaped-entities": "error",
37
+ "react/void-dom-elements-no-children": "error",
25
38
  "jsx-a11y/aria-props": "error",
26
39
  "jsx-a11y/aria-unsupported-elements": "error",
27
40
  "jsx-a11y/iframe-has-title": "error",
28
41
  "jsx-a11y/img-redundant-alt": "warn",
29
42
  "jsx-a11y/no-access-key": "error",
43
+ "unused-imports/no-unused-imports": "warn",
44
+ "@typescript-eslint/ban-types": "warn",
30
45
  "@typescript-eslint/no-unused-vars": "warn",
31
46
  "@typescript-eslint/no-use-before-define": "error",
32
47
  "@typescript-eslint/no-shadow": "error",