@haltcase/style 6.2.1 → 7.0.0-canary.2

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 (59) hide show
  1. package/eslint/configs/browser.js +19 -0
  2. package/eslint/configs/cjs.js +1 -0
  3. package/eslint/configs/internal/base.js +180 -0
  4. package/eslint/configs/internal/commonjs.js +22 -0
  5. package/eslint/{rules → configs/internal}/es2015.js +14 -16
  6. package/eslint/configs/internal/simple-import-sort.js +24 -0
  7. package/eslint/configs/internal/tsdoc.js +17 -0
  8. package/eslint/{rules → configs/internal}/unicorn.js +116 -121
  9. package/eslint/configs/next.js +36 -0
  10. package/eslint/configs/node.js +19 -0
  11. package/eslint/configs/playwright-test.js +17 -0
  12. package/eslint/configs/react.js +54 -0
  13. package/eslint/configs/typescript.js +84 -0
  14. package/eslint/constants.js +12 -28
  15. package/eslint/index.js +27 -0
  16. package/eslint/rules/best-practice.js +250 -245
  17. package/eslint/rules/imports.js +94 -0
  18. package/eslint/rules/jsx-a11y.js +11 -10
  19. package/eslint/rules/playwright-test.js +25 -26
  20. package/eslint/rules/possible-errors.js +38 -45
  21. package/eslint/rules/react.js +105 -104
  22. package/eslint/rules/stylistic.js +83 -84
  23. package/eslint/rules/typescript/extension.js +55 -39
  24. package/eslint/rules/typescript/import.js +16 -15
  25. package/eslint/rules/typescript/index.js +109 -121
  26. package/eslint/rules/typescript/naming-convention.js +71 -0
  27. package/eslint/rules/variables.js +34 -34
  28. package/eslint/withFiles.js +15 -0
  29. package/package.json +58 -56
  30. package/prettier/index.js +4 -11
  31. package/readme.md +181 -98
  32. package/stylelint/_base.js +2 -4
  33. package/stylelint/index.js +6 -7
  34. package/stylelint/modules.js +7 -8
  35. package/stylelint/standard.js +2 -5
  36. package/typescript/tsconfig.base.json +2 -1
  37. package/typescript/tsconfig.bundler.json +7 -3
  38. package/typescript/tsconfig.next.json +14 -6
  39. package/typescript/tsconfig.node.json +1 -1
  40. package/typescript/tsconfig.node18.json +4 -7
  41. package/typescript/tsconfig.node20.json +4 -7
  42. package/typescript/tsconfig.node22.json +10 -0
  43. package/typescript/tsconfig.web.json +1 -1
  44. package/eslint/_base.js +0 -82
  45. package/eslint/astro.js +0 -40
  46. package/eslint/browser.js +0 -8
  47. package/eslint/cjs.js +0 -12
  48. package/eslint/jest.js +0 -28
  49. package/eslint/next.js +0 -38
  50. package/eslint/node.js +0 -8
  51. package/eslint/playwright-test.js +0 -8
  52. package/eslint/react.js +0 -18
  53. package/eslint/rules/import.js +0 -92
  54. package/eslint/rules/jest.js +0 -28
  55. package/eslint/rules/simple-import-sort.js +0 -23
  56. package/eslint/rules/tsdoc.js +0 -17
  57. package/eslint/rules/typescript/strict.js +0 -18
  58. package/eslint/typescript.js +0 -26
  59. package/eslint/utils/require-package.js +0 -44
package/eslint/astro.js DELETED
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- const {
4
- levels: { error },
5
- astroFiles
6
- } = require("./constants");
7
- const checkForPackage = require("./utils/require-package");
8
-
9
- checkForPackage("astro", "eslint-plugin-astro");
10
-
11
- module.exports = {
12
- extends: ["plugin:astro/recommended"],
13
- overrides: [
14
- {
15
- files: astroFiles,
16
- parser: "astro-eslint-parser",
17
- parserOptions: {
18
- parser: "@typescript-eslint/parser",
19
- extraFileExtensions: [".astro"]
20
- },
21
- rules: {
22
- // override/add rules settings here, such as:
23
- // "astro/no-set-html-directive": "error"
24
- }
25
- },
26
- {
27
- files: ["./src/env.d.ts"],
28
- rules: {
29
- "unicorn/prevent-abbreviations": [
30
- error,
31
- {
32
- allowList: {
33
- env: true
34
- }
35
- }
36
- ]
37
- }
38
- }
39
- ]
40
- };
package/eslint/browser.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = {
4
- extends: require.resolve("./_base"),
5
- env: {
6
- browser: true
7
- }
8
- };
package/eslint/cjs.js DELETED
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- const { commonJsFiles, commonJsOverrides } = require("./constants");
4
-
5
- module.exports = {
6
- overrides: [
7
- {
8
- files: commonJsFiles,
9
- ...commonJsOverrides
10
- }
11
- ]
12
- };
package/eslint/jest.js DELETED
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- const {
4
- levels: { off, error },
5
- typescriptFiles
6
- } = require("./constants");
7
-
8
- module.exports = {
9
- plugins: ["testing-library"],
10
- extends: [
11
- "plugin:jest/recommended",
12
- // We may want to separate this out in future, as it's only needed when
13
- // using React with Testing Library.
14
- "plugin:testing-library/react",
15
- require.resolve("./rules/jest")
16
- ],
17
- overrides: [
18
- // Prefer the Jest version of this rule. This silently fails when type
19
- // information is not available.
20
- {
21
- files: typescriptFiles,
22
- rules: {
23
- "@typescript-eslint/unbound-method": off,
24
- "jest/unbound-method": error
25
- }
26
- }
27
- ]
28
- };
package/eslint/next.js DELETED
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- const {
4
- javascriptFiles,
5
- levels: { off },
6
- nextJsPageFiles,
7
- nextJsApiRoutes
8
- } = require("./constants");
9
- const checkForPackage = require("./utils/require-package");
10
-
11
- checkForPackage("next", "@next/eslint-plugin-next");
12
-
13
- const babelOptions = {
14
- presets: (() => {
15
- try {
16
- require.resolve("next/babel");
17
- return ["next/babel"];
18
- } catch {
19
- return [];
20
- }
21
- })()
22
- };
23
-
24
- module.exports = {
25
- extends: ["plugin:@next/next/recommended"],
26
- overrides: [
27
- {
28
- files: javascriptFiles,
29
- parserOptions: { babelOptions }
30
- },
31
- {
32
- files: [...nextJsPageFiles, ...nextJsApiRoutes],
33
- rules: {
34
- "import/no-default-export": off
35
- }
36
- }
37
- ]
38
- };
package/eslint/node.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = {
4
- extends: require.resolve("./_base"),
5
- env: {
6
- node: true
7
- }
8
- };
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = {
4
- extends: [
5
- "plugin:playwright/playwright-test",
6
- require.resolve("./rules/playwright-test.js")
7
- ]
8
- };
package/eslint/react.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = {
4
- extends: [
5
- "plugin:react/recommended",
6
- "plugin:react-hooks/recommended",
7
- "plugin:jsx-a11y/recommended",
8
- "plugin:import/react",
9
- "prettier",
10
- require.resolve("./rules/react"),
11
- require.resolve("./rules/jsx-a11y")
12
- ],
13
- settings: {
14
- react: {
15
- version: "detect"
16
- }
17
- }
18
- };
@@ -1,92 +0,0 @@
1
- "use strict";
2
-
3
- const {
4
- levels: { off, warn, error }
5
- } = require("../constants");
6
-
7
- const disabledRules = {
8
- /**
9
- * Enforce a module import order convention.
10
- * This is disabled as it is covered by `eslint-plugin-simple-import-sort`.
11
- *
12
- * 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
13
- */
14
- "import/order": off
15
- };
16
-
17
- module.exports = {
18
- rules: {
19
- ...disabledRules,
20
- /**
21
- * Disallow non-import statements appearing before import statements.
22
- *
23
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
24
- */
25
- "import/first": error,
26
- /**
27
- * Require a newline after the last import/require.
28
- *
29
- * 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
30
- */
31
- "import/newline-after-import": warn,
32
- /**
33
- * Disallow import of modules using absolute paths.
34
- *
35
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-absolute-path.md
36
- */
37
- "import/no-absolute-path": error,
38
- /**
39
- * Disallow cyclical dependencies between modules.
40
- *
41
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md
42
- */
43
- "import/no-cycle": error,
44
- /**
45
- * Disallow default exports.
46
- *
47
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
48
- */
49
- "import/no-default-export": error,
50
- /**
51
- * Combine separate imports of resolved paths.
52
- *
53
- * 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md
54
- */
55
- "import/no-duplicates": [
56
- error,
57
- {
58
- considerQueryString: true
59
- }
60
- ],
61
- /**
62
- * Disallow the use of extraneous packages.
63
- *
64
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md
65
- */
66
- "import/no-extraneous-dependencies": [error, { includeTypes: true }],
67
- /**
68
- * Disallow mutable exports.
69
- *
70
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-mutable-exports.md
71
- */
72
- "import/no-mutable-exports": error,
73
- /**
74
- * Disallow importing packages through relative paths.
75
- *
76
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-packages.md
77
- */
78
- "import/no-relative-packages": warn,
79
- /**
80
- * Disallow a module from importing itself.
81
- *
82
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-self-import.md
83
- */
84
- "import/no-self-import": error,
85
- /**
86
- * Ensures that there are no useless path segments.
87
- *
88
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md
89
- */
90
- "import/no-useless-path-segments": [error]
91
- }
92
- };
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- const {
4
- levels: { warn, error }
5
- } = require("../constants");
6
-
7
- module.exports = {
8
- rules: {
9
- /**
10
- * Disallow duplicate setup and teardown hooks.
11
- *
12
- * 🚫 Not fixable - https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-duplicate-hooks.md
13
- */
14
- "jest/no-duplicate-hooks": error,
15
- /**
16
- * Require lowercase test names.
17
- *
18
- * 🔧 Fixable - https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-lowercase-title.md
19
- */
20
- "jest/prefer-lowercase-title": warn,
21
- /**
22
- * Require test cases and hooks to be inside a `describe` block.
23
- *
24
- * 🚫 Not fixable - https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-top-level-describe.md
25
- */
26
- "jest/require-top-level-describe": error
27
- }
28
- };
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- const {
4
- levels: { error }
5
- } = require("../constants");
6
-
7
- module.exports = {
8
- plugins: ["simple-import-sort"],
9
- rules: {
10
- /**
11
- * Enforce export sort order.
12
- *
13
- * 🔧 Fixable - https://github.com/lydell/eslint-plugin-simple-import-sort#exports
14
- */
15
- "simple-import-sort/exports": error,
16
- /**
17
- * Enforce import sort order.
18
- *
19
- * 🔧 Fixable - https://github.com/lydell/eslint-plugin-simple-import-sort#imports
20
- */
21
- "simple-import-sort/imports": error
22
- }
23
- };
@@ -1,17 +0,0 @@
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
- };
@@ -1,18 +0,0 @@
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
- };
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- const { typescriptFiles } = require("./constants");
4
- const checkForPackage = require("./utils/require-package");
5
-
6
- checkForPackage("typescript", "typescript");
7
-
8
- module.exports = {
9
- overrides: [
10
- {
11
- files: typescriptFiles,
12
- extends: [
13
- "plugin:@typescript-eslint/recommended-type-checked",
14
- "plugin:@typescript-eslint/strict-type-checked",
15
- "plugin:@typescript-eslint/stylistic-type-checked",
16
- "plugin:import/typescript",
17
- "prettier",
18
- require.resolve("./rules/typescript"),
19
- require.resolve("./rules/typescript/extension"),
20
- require.resolve("./rules/typescript/import"),
21
- require.resolve("./rules/typescript/strict"),
22
- require.resolve("./rules/tsdoc")
23
- ]
24
- }
25
- ]
26
- };
@@ -1,44 +0,0 @@
1
- // @ts-check
2
- "use strict";
3
-
4
- const packageJson = require("../../package.json");
5
-
6
- /**
7
- * @returns {string} The name of the package manager.
8
- */
9
- const readPackageManager = () => {
10
- const match = process.env.npm_config_user_agent?.match(/^(?<pm>\w+)\//);
11
- return match?.groups ? match.groups?.pm : "npm";
12
- };
13
-
14
- /**
15
- * @param {string} configName
16
- * @param {string} packageName
17
- */
18
- module.exports = (configName, packageName) => {
19
- try {
20
- require.resolve(packageName);
21
- } catch {
22
- const packageManager = readPackageManager();
23
- const command =
24
- packageManager === "yarn" || packageManager === "pnpm"
25
- ? "add"
26
- : "install";
27
-
28
- // eslint-disable-next-line unicorn/prevent-abbreviations
29
- const dev = packageManager === "yarn" ? "--dev" : "--save-dev";
30
-
31
- /* eslint-disable no-console */
32
- console.error(
33
- `The \`${configName}\` config requires an optional peer dependency, which has not been installed.`
34
- );
35
- console.error();
36
- console.error("To install it, run:");
37
- console.error(
38
- `- ${packageManager} ${command} ${dev} ${packageName}@${packageJson.peerDependencies[packageName]}`
39
- );
40
- /* eslint-enable no-console */
41
-
42
- throw new Error(`Missing dependency encountered: ${packageName}`);
43
- }
44
- };