@haltcase/style 1.0.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.
Files changed (39) hide show
  1. package/LICENSE.md +382 -0
  2. package/eslint/_base.js +52 -0
  3. package/eslint/browser.js +8 -0
  4. package/eslint/cjs.js +21 -0
  5. package/eslint/constants.js +13 -0
  6. package/eslint/jest.js +28 -0
  7. package/eslint/next.js +27 -0
  8. package/eslint/node.js +8 -0
  9. package/eslint/playwright-test.js +8 -0
  10. package/eslint/react.js +18 -0
  11. package/eslint/rules/best-practice.js +239 -0
  12. package/eslint/rules/es2015.js +71 -0
  13. package/eslint/rules/import.js +85 -0
  14. package/eslint/rules/jest.js +28 -0
  15. package/eslint/rules/jsx-a11y.js +20 -0
  16. package/eslint/rules/playwright-test.js +28 -0
  17. package/eslint/rules/possible-errors.js +47 -0
  18. package/eslint/rules/react.js +117 -0
  19. package/eslint/rules/simple-import-sort.js +23 -0
  20. package/eslint/rules/stylistic.js +86 -0
  21. package/eslint/rules/tsdoc.js +17 -0
  22. package/eslint/rules/typescript/extension.js +45 -0
  23. package/eslint/rules/typescript/import.js +22 -0
  24. package/eslint/rules/typescript/index.js +89 -0
  25. package/eslint/rules/typescript/strict.js +18 -0
  26. package/eslint/rules/unicorn.js +677 -0
  27. package/eslint/rules/variables.js +36 -0
  28. package/eslint/typescript.js +26 -0
  29. package/eslint/utils/require-package.js +44 -0
  30. package/package.json +100 -0
  31. package/prettier/index.js +21 -0
  32. package/readme.md +228 -0
  33. package/typescript/tsconfig.base.json +13 -0
  34. package/typescript/tsconfig.bundler.json +13 -0
  35. package/typescript/tsconfig.next.json +26 -0
  36. package/typescript/tsconfig.node.json +4 -0
  37. package/typescript/tsconfig.node18.json +13 -0
  38. package/typescript/tsconfig.node20.json +13 -0
  39. package/typescript/tsconfig.web.json +8 -0
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ const {
4
+ levels: { warn, error }
5
+ } = require("../constants");
6
+
7
+ module.exports = {
8
+ rules: {
9
+ /**
10
+ * Require camel case names.
11
+ *
12
+ * 🚫 Not fixable - https://eslint.org/docs/rules/camelcase
13
+ */
14
+ camelcase: [
15
+ error,
16
+ { allow: ["^UNSAFE_"], ignoreDestructuring: false, properties: "never" }
17
+ ],
18
+ /**
19
+ * Require function expressions to have a name.
20
+ *
21
+ * 🚫 Not fixable - https://eslint.org/docs/rules/func-names
22
+ */
23
+ "func-names": [error, "as-needed"],
24
+ /**
25
+ * Require a capital letter for constructors.
26
+ *
27
+ * 🚫 Not fixable - https://eslint.org/docs/rules/new-cap
28
+ */
29
+ "new-cap": [error, { capIsNew: false }],
30
+ /**
31
+ * Disallow the omission of parentheses when invoking a constructor with
32
+ * no arguments.
33
+ *
34
+ * 🔧 Fixable - https://eslint.org/docs/rules/new-parens
35
+ */
36
+ "new-parens": warn,
37
+ /**
38
+ * Disallow use of the Array constructor.
39
+ *
40
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-array-constructor
41
+ */
42
+ "no-array-constructor": error,
43
+ /**
44
+ * Disallow use of bitwise operators.
45
+ *
46
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-bitwise
47
+ */
48
+ "no-bitwise": error,
49
+ /**
50
+ * Disallow if as the only statement in an else block.
51
+ *
52
+ * 🔧 Fixable - https://eslint.org/docs/rules/no-lonely-if
53
+ */
54
+ "no-lonely-if": warn,
55
+ /**
56
+ * Disallow use of chained assignment expressions.
57
+ *
58
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-multi-assign
59
+ */
60
+ "no-multi-assign": [error],
61
+ /**
62
+ * Disallow nested ternary expressions.
63
+ *
64
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-nested-ternary
65
+ */
66
+ "no-nested-ternary": error,
67
+ /**
68
+ * Disallow ternary operators when simpler alternatives exist.
69
+ *
70
+ * 🚫 Not fixable - https://eslint.org/docs/rules/no-unneeded-ternary
71
+ */
72
+ "no-unneeded-ternary": error,
73
+ /**
74
+ * Require using arrow functions for callbacks.
75
+ *
76
+ * 🔧 Fixable - https://eslint.org/docs/rules/prefer-arrow-callback
77
+ */
78
+ "prefer-arrow-callback": [error, { allowNamedFunctions: true }],
79
+ /**
80
+ * Require use of an object spread over Object.assign.
81
+ *
82
+ * 🔧 Fixable - https://eslint.org/docs/rules/prefer-object-spread
83
+ */
84
+ "prefer-object-spread": warn
85
+ }
86
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ const {
4
+ levels: { error }
5
+ } = require("../constants");
6
+
7
+ module.exports = {
8
+ plugins: ["eslint-plugin-tsdoc"],
9
+ rules: {
10
+ /**
11
+ * Require TSDoc comments conform to the TSDoc specification.
12
+ *
13
+ * 🚫 Not fixable - https://github.com/microsoft/tsdoc/tree/master/eslint-plugin
14
+ */
15
+ "tsdoc/syntax": error
16
+ }
17
+ };
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ const {
4
+ levels: { error }
5
+ } = require("../constants");
6
+
7
+ // These share identical configuration options, so we want to keep them in sync.
8
+ // eslint-disable-next-line unicorn/prevent-abbreviations
9
+ const noUnusedVarsConfig = require("../variables").rules["no-unused-vars"];
10
+
11
+ module.exports = {
12
+ rules: {
13
+ /**
14
+ * Require default parameters to be last.
15
+ *
16
+ * 🚫 Not fixable - https://typescript-eslint.io/rules/default-param-last/
17
+ */
18
+ "@typescript-eslint/default-param-last": error,
19
+ /**
20
+ * Disallow creation of functions within loops.
21
+ *
22
+ * 🚫 Not fixable - https://typescript-eslint.io/rules/no-loop-func/
23
+ */
24
+ "@typescript-eslint/no-loop-func": error,
25
+ /**
26
+ * Disallow variable declarations from shadowing variables declared in the
27
+ * outer scope.
28
+ *
29
+ * 🚫 Not fixable - https://typescript-eslint.io/rules/no-shadow/
30
+ */
31
+ "@typescript-eslint/no-shadow": error,
32
+ /**
33
+ * Disallow unused variables.
34
+ *
35
+ * 🚫 Not fixable - https://typescript-eslint.io/rules/no-unused-vars/
36
+ */
37
+ "@typescript-eslint/no-unused-vars": noUnusedVarsConfig,
38
+ /**
39
+ * Disallow unnecessary constructors.
40
+ *
41
+ * 🚫 Not fixable - https://typescript-eslint.io/rules/no-useless-constructor/
42
+ */
43
+ "@typescript-eslint/no-useless-constructor": error
44
+ }
45
+ };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ const {
4
+ levels: { off }
5
+ } = require("../constants");
6
+
7
+ /**
8
+ * These are enabled by `import/recommended`, but are better handled by
9
+ * TypeScript and @typescript-eslint.
10
+ */
11
+ const disabledRules = {
12
+ "import/default": off,
13
+ "import/export": off,
14
+ "import/namespace": off,
15
+ "import/no-unresolved": off
16
+ };
17
+
18
+ module.exports = {
19
+ rules: {
20
+ ...disabledRules
21
+ }
22
+ };
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+
3
+ const {
4
+ levels: { warn, error }
5
+ } = require("../constants");
6
+
7
+ module.exports = {
8
+ rules: {
9
+ /**
10
+ * Require consistent usage of type exports.
11
+ *
12
+ * 🔧 Fixable - https://typescript-eslint.io/rules/consistent-type-exports/
13
+ */
14
+ "@typescript-eslint/consistent-type-exports": [
15
+ warn,
16
+ { fixMixedExportsWithInlineTypeSpecifier: true }
17
+ ],
18
+ /**
19
+ * Require consistent usage of type imports.
20
+ *
21
+ * 🔧 Fixable - https://typescript-eslint.io/rules/consistent-type-imports/
22
+ */
23
+ "@typescript-eslint/consistent-type-imports": warn,
24
+ /**
25
+ * Require explicit return types on functions and class methods.
26
+ *
27
+ * 🚫 Not fixable - https://typescript-eslint.io/rules/explicit-function-return-type/
28
+ */
29
+ "@typescript-eslint/explicit-function-return-type": warn,
30
+ /**
31
+ * Require using function property types in method signatures.
32
+ *
33
+ * These have enhanced typechecking, whereas method signatures do not.
34
+ *
35
+ * 🔧 Fixable - https://typescript-eslint.io/rules/method-signature-style/
36
+ */
37
+ "@typescript-eslint/method-signature-style": warn,
38
+ /**
39
+ * Require consistent naming conventions.
40
+ *
41
+ * Improves IntelliSense suggestions and avoids name collisions.
42
+ *
43
+ * 🚫 Not fixable - https://typescript-eslint.io/rules/naming-convention/
44
+ */
45
+ "@typescript-eslint/naming-convention": [
46
+ error,
47
+ // Anything type-like should be written in PascalCase.
48
+ {
49
+ format: ["PascalCase"],
50
+ selector: ["typeLike", "enumMember"]
51
+ },
52
+ // Interfaces cannot be prefixed with `I`, or have restricted names.
53
+ {
54
+ custom: {
55
+ match: false,
56
+ regex: "^I[A-Z]|^(Interface|Props|State)$"
57
+ },
58
+ format: ["PascalCase"],
59
+ selector: "interface"
60
+ }
61
+ ],
62
+ /**
63
+ * Disallow members of unions and intersections that do nothing or override type information.
64
+ *
65
+ * 🚫 Not fixable - https://typescript-eslint.io/rules/no-redundant-type-constituents/
66
+ */
67
+ "@typescript-eslint/no-redundant-type-constituents": warn,
68
+ /**
69
+ * Disallow unnecessary namespace qualifiers.
70
+ *
71
+ * 🔧 Fixable - https://typescript-eslint.io/rules/no-unnecessary-qualifier/
72
+ */
73
+ "@typescript-eslint/no-unnecessary-qualifier": warn,
74
+ /**
75
+ * Require using `RegExp.exec()` over `String.match()` for consistency.
76
+ *
77
+ * 🔧 Fixable - https://typescript-eslint.io/rules/prefer-regexp-exec/
78
+ */
79
+ "@typescript-eslint/prefer-regexp-exec": warn,
80
+ /**
81
+ * Require exhaustive checks when using union types in switch statements.
82
+ *
83
+ * This ensures cases are considered when items are later added to a union.
84
+ *
85
+ * 🚫 Not fixable - https://typescript-eslint.io/rules/switch-exhaustiveness-check/
86
+ */
87
+ "@typescript-eslint/switch-exhaustiveness-check": error
88
+ }
89
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ const {
4
+ levels: { off }
5
+ } = require("../constants");
6
+
7
+ const disabledRules = {
8
+ // This is disabled as we feel that checking empty strings is a valid use
9
+ // of `||` over `??`. We'll track this related issue:
10
+ // https://github.com/typescript-eslint/typescript-eslint/issues/4906
11
+ "@typescript-eslint/prefer-nullish-coalescing": off
12
+ };
13
+
14
+ module.exports = {
15
+ rules: {
16
+ ...disabledRules
17
+ }
18
+ };