@haltcase/style 8.0.0-canary.8 → 8.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 (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +235 -0
  3. package/package.json +151 -172
  4. package/LICENSE.md +0 -382
  5. package/dist/types/eslint/configs/browser.d.ts +0 -8
  6. package/dist/types/eslint/configs/cjs.d.ts +0 -4
  7. package/dist/types/eslint/configs/internal/base.d.ts +0 -76
  8. package/dist/types/eslint/configs/internal/commonjs.d.ts +0 -4
  9. package/dist/types/eslint/configs/internal/es2015.d.ts +0 -4
  10. package/dist/types/eslint/configs/internal/simple-import-sort.d.ts +0 -4
  11. package/dist/types/eslint/configs/internal/tsdoc.d.ts +0 -4
  12. package/dist/types/eslint/configs/internal/unicorn.d.ts +0 -4
  13. package/dist/types/eslint/configs/internal/utils/typescript.d.ts +0 -6
  14. package/dist/types/eslint/configs/next.d.ts +0 -8
  15. package/dist/types/eslint/configs/node.d.ts +0 -8
  16. package/dist/types/eslint/configs/playwright-test.d.ts +0 -4
  17. package/dist/types/eslint/configs/react.d.ts +0 -8
  18. package/dist/types/eslint/configs/typescript.d.ts +0 -10
  19. package/dist/types/eslint/constants.d.ts +0 -14
  20. package/dist/types/eslint/index.d.ts +0 -12
  21. package/dist/types/eslint/rules/best-practice.d.ts +0 -5
  22. package/dist/types/eslint/rules/imports.d.ts +0 -5
  23. package/dist/types/eslint/rules/jsx-a11y.d.ts +0 -5
  24. package/dist/types/eslint/rules/playwright-test.d.ts +0 -8
  25. package/dist/types/eslint/rules/possible-errors.d.ts +0 -8
  26. package/dist/types/eslint/rules/react-x.d.ts +0 -8
  27. package/dist/types/eslint/rules/react.d.ts +0 -11
  28. package/dist/types/eslint/rules/stylistic-jsx.d.ts +0 -8
  29. package/dist/types/eslint/rules/stylistic.d.ts +0 -8
  30. package/dist/types/eslint/rules/typescript/extension.d.ts +0 -5
  31. package/dist/types/eslint/rules/typescript/import.d.ts +0 -5
  32. package/dist/types/eslint/rules/typescript/index.d.ts +0 -8
  33. package/dist/types/eslint/rules/typescript/naming-convention.d.ts +0 -5
  34. package/dist/types/eslint/rules/variables.d.ts +0 -8
  35. package/dist/types/eslint/withFiles.d.ts +0 -2
  36. package/dist/types/prettier/index.d.ts +0 -12
  37. package/dist/types/stylelint/_base.d.ts +0 -1
  38. package/dist/types/stylelint/index.d.ts +0 -2
  39. package/dist/types/stylelint/modules.d.ts +0 -2
  40. package/dist/types/stylelint/standard.d.ts +0 -1
  41. package/dist/types/stylelint/tailwind.d.ts +0 -2
  42. package/eslint/configs/browser.js +0 -27
  43. package/eslint/configs/cjs.js +0 -13
  44. package/eslint/configs/internal/base.js +0 -205
  45. package/eslint/configs/internal/commonjs.js +0 -22
  46. package/eslint/configs/internal/es2015.js +0 -72
  47. package/eslint/configs/internal/simple-import-sort.js +0 -27
  48. package/eslint/configs/internal/tsdoc.js +0 -20
  49. package/eslint/configs/internal/unicorn.js +0 -750
  50. package/eslint/configs/internal/utils/typescript.js +0 -53
  51. package/eslint/configs/next.js +0 -54
  52. package/eslint/configs/node.js +0 -27
  53. package/eslint/configs/playwright-test.js +0 -21
  54. package/eslint/configs/react.js +0 -114
  55. package/eslint/configs/typescript.js +0 -125
  56. package/eslint/constants.js +0 -27
  57. package/eslint/index.js +0 -33
  58. package/eslint/rules/best-practice.js +0 -256
  59. package/eslint/rules/imports.js +0 -94
  60. package/eslint/rules/jsx-a11y.js +0 -21
  61. package/eslint/rules/playwright-test.js +0 -27
  62. package/eslint/rules/possible-errors.js +0 -40
  63. package/eslint/rules/react-x.js +0 -78
  64. package/eslint/rules/react.js +0 -24
  65. package/eslint/rules/stylistic-jsx.js +0 -17
  66. package/eslint/rules/stylistic.js +0 -85
  67. package/eslint/rules/typescript/extension.js +0 -74
  68. package/eslint/rules/typescript/import.js +0 -23
  69. package/eslint/rules/typescript/index.js +0 -114
  70. package/eslint/rules/typescript/naming-convention.js +0 -121
  71. package/eslint/rules/variables.js +0 -36
  72. package/eslint/withFiles.js +0 -15
  73. package/prettier/index.js +0 -39
  74. package/readme.md +0 -415
  75. package/stylelint/_base.js +0 -45
  76. package/stylelint/index.js +0 -20
  77. package/stylelint/modules.js +0 -32
  78. package/stylelint/standard.js +0 -4
  79. package/stylelint/tailwind.js +0 -16
  80. package/typescript/tsconfig.base.json +0 -14
  81. package/typescript/tsconfig.bundler.json +0 -17
  82. package/typescript/tsconfig.next.json +0 -36
  83. package/typescript/tsconfig.node-ts.json +0 -10
  84. package/typescript/tsconfig.node.json +0 -4
  85. package/typescript/tsconfig.node18.json +0 -10
  86. package/typescript/tsconfig.node20.json +0 -11
  87. package/typescript/tsconfig.node22.json +0 -11
  88. package/typescript/tsconfig.node24.json +0 -17
  89. package/typescript/tsconfig.web.json +0 -8
@@ -1,5 +0,0 @@
1
- /**
2
- * @type {Linter.RulesRecord}
3
- */
4
- export const typescriptExtensionRules: Linter.RulesRecord;
5
- import type { Linter } from "eslint";
@@ -1,5 +0,0 @@
1
- /**
2
- * @type {Linter.RulesRecord}
3
- */
4
- export const typescriptImportRules: Linter.RulesRecord;
5
- import type { Linter } from "eslint";
@@ -1,8 +0,0 @@
1
- /**
2
- * @import { Linter } from "eslint"
3
- */
4
- /**
5
- * @type {Linter.RulesRecord}
6
- */
7
- export const typescriptBaseRules: Linter.RulesRecord;
8
- import type { Linter } from "eslint";
@@ -1,5 +0,0 @@
1
- export function getTypescriptNamingConventionRule({ isComponentLike, isTsx }?: {
2
- isComponentLike?: boolean | undefined;
3
- isTsx?: boolean | undefined;
4
- }): Linter.RulesRecord;
5
- import type { Linter } from "eslint";
@@ -1,8 +0,0 @@
1
- /**
2
- * @import { Linter } from "eslint"
3
- */
4
- /**
5
- * @type {Linter.RulesRecord}
6
- */
7
- export const variablesRules: Linter.RulesRecord;
8
- import type { Linter } from "eslint";
@@ -1,2 +0,0 @@
1
- export function withFiles(configArray: Linter.Config[], files: string[]): Linter.Config[];
2
- import type { Linter } from "eslint";
@@ -1,12 +0,0 @@
1
- declare namespace _default {
2
- let singleQuote: boolean;
3
- let trailingComma: string;
4
- let plugins: string[];
5
- let tailwindAttributes: string[];
6
- let tailwindFunctions: string[];
7
- let endOfLine: "lf";
8
- let printWidth: number;
9
- let tabWidth: number;
10
- let useTabs: true;
11
- }
12
- export default _default;
@@ -1 +0,0 @@
1
- export const stylelintBase: import("stylelint-define-config").StylelintConfig;
@@ -1,2 +0,0 @@
1
- declare const _default: import("stylelint-define-config").StylelintConfig;
2
- export default _default;
@@ -1,2 +0,0 @@
1
- declare const _default: import("stylelint-define-config").StylelintConfig;
2
- export default _default;
@@ -1 +0,0 @@
1
- export { stylelintBase as default } from "./_base.js";
@@ -1,2 +0,0 @@
1
- declare const _default: import("stylelint-define-config").StylelintConfig;
2
- export default _default;
@@ -1,27 +0,0 @@
1
- import globals from "globals";
2
- import { config } from "typescript-eslint";
3
-
4
- import { getEslintBaseConfig } from "./internal/base.js";
5
-
6
- /**
7
- * @type {import("./internal/base.js").HaltcaseStyleCreator}
8
- */
9
- export const getEslintBrowserConfig = (options = {}) =>
10
- config(
11
- ...getEslintBaseConfig(options),
12
- ...getEslintBrowserConfigInternal(options)
13
- );
14
-
15
- /**
16
- * @type {import("./internal/base.js").HaltcaseStyleCreator}
17
- */
18
- export const getEslintBrowserConfigInternal = (_options = {}) =>
19
- config({
20
- name: "Browser",
21
-
22
- languageOptions: {
23
- globals: {
24
- ...globals.browser
25
- }
26
- }
27
- });
@@ -1,13 +0,0 @@
1
- import { config } from "typescript-eslint";
2
-
3
- import { getEslintBaseConfig } from "./internal/base.js";
4
- import { getEslintCommonJsConfigInternal } from "./internal/commonjs.js";
5
-
6
- /**
7
- * @type {import("./internal/base.js").HaltcaseStyleCreator}
8
- */
9
- export const getEslintCommonJsConfig = (options) =>
10
- config(
11
- ...getEslintBaseConfig(options),
12
- ...getEslintCommonJsConfigInternal(options)
13
- );
@@ -1,205 +0,0 @@
1
- /**
2
- * @import { type ParserOptions } from "@typescript-eslint/types"
3
- */
4
-
5
- import babelParser from "@babel/eslint-parser";
6
- import eslint from "@eslint/js";
7
- import eslintPluginEslintComments from "@eslint-community/eslint-plugin-eslint-comments";
8
- import eslintConfigPrettier from "eslint-config-prettier";
9
- import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
10
- import * as eslintPluginImportX from "eslint-plugin-import-x";
11
- import eslintRegexp from "eslint-plugin-regexp";
12
- import { config } from "typescript-eslint";
13
-
14
- import {
15
- allSupportedFiles,
16
- configFiles,
17
- ecmaVersion,
18
- javascriptFiles,
19
- scriptFiles
20
- } from "../../constants.js";
21
- import { bestPracticeRules } from "../../rules/best-practice.js";
22
- import { importRules } from "../../rules/imports.js";
23
- import { possibleErrorsRules } from "../../rules/possible-errors.js";
24
- import { stylisticRules } from "../../rules/stylistic.js";
25
- import { variablesRules } from "../../rules/variables.js";
26
- import { getEslintTypescriptConfigInternal } from "../typescript.js";
27
- import { getEslintCommonJsConfigInternal } from "./commonjs.js";
28
- import { eslintEs2015Config } from "./es2015.js";
29
- import { eslintSimpleImportSortConfig } from "./simple-import-sort.js";
30
- import { eslintUnicornConfig } from "./unicorn.js";
31
- import { prepareTypeScriptProjectConfig } from "./utils/typescript.js";
32
-
33
- /**
34
- * @typedef {Object} TypeScriptProjectServiceOptions
35
- * @property {true} projectService Use the TypeScript ESLint [project service](https://typescript-eslint.io/packages/parser#projectservice).
36
- * @property {string | string[] | undefined} [tsconfigPaths] Paths to tsconfig.json files for resolving and linting imports.
37
- * This defaults to `<root>/tsconfig.json` or `<root>/jsconfig.json` and
38
- * [project references](https://www.typescriptlang.org/docs/handbook/project-references.html) are supported.
39
- */
40
-
41
- /**
42
- * @typedef {ParserOptions["project"] | TypeScriptProjectServiceOptions} TypeScriptProjectOptions
43
- */
44
-
45
- /**
46
- * @typedef {Object} HaltcaseStyleOptions
47
- * @property {boolean} [browser] Whether to include browser rules and globals.
48
- * @property {boolean} [commonjs] Whether to treat *.js files as CommonJS instead of ES Modules.
49
- * @property {boolean} [nextjs] Whether to include Next.js rules (implies `react`).
50
- * @property {boolean} [node] Whether to include Node.js rules.
51
- * @property {boolean} [react] Whether to include React rules.
52
- * @property {string[]} [typescriptComponentPaths] Additional paths to consider as TypeScript component files.
53
- * @property {TypeScriptProjectOptions} [typescriptProject] Custom TypeScript project options for
54
- * the `typescript-eslint` parser and `eslint-import-resolver-typescript`.
55
- */
56
-
57
- /*
58
- * // use when VS Code supports `projectService`
59
- * // https://github.com/microsoft/vscode-eslint/issues/1911
60
- * property {ProjectServiceOptions} [typescriptProjectServiceOptions = true] Custom TypeScript project service options for the `typescript-eslint` parser.
61
- */
62
-
63
- /**
64
- * @typedef {(options?: HaltcaseStyleOptions) => Awaited<import("typescript-eslint").Config>} HaltcaseStyleCreator
65
- */
66
-
67
- /**
68
- * Get the common ESLint config for Node and browsers.
69
- *
70
- * @type {HaltcaseStyleCreator}
71
- */
72
- export const getEslintBaseConfig = (options = {}) => {
73
- const { resolverOptions } = prepareTypeScriptProjectConfig(
74
- options.typescriptProject
75
- );
76
-
77
- return config(
78
- {
79
- name: "import-x/recommended",
80
- plugins: {
81
- "import-x": eslintPluginImportX
82
- },
83
- rules: {
84
- ...eslintPluginImportX.flatConfigs.recommended.rules
85
- },
86
- settings: {
87
- "import-x/parsers": {
88
- "@typescript-eslint/parser": [".ts"]
89
- },
90
- "import-x/resolver-next": [
91
- createTypeScriptImportResolver({
92
- ...resolverOptions
93
- }),
94
-
95
- eslintPluginImportX.createNodeResolver()
96
- ]
97
- }
98
- },
99
-
100
- {
101
- name: "@haltcase/internal/base",
102
-
103
- extends: [
104
- { name: "eslint/recommended", ...eslint.configs.recommended },
105
-
106
- { name: "prettier", ...eslintConfigPrettier },
107
-
108
- {
109
- name: "eslint-comments",
110
- rules: {
111
- ...eslintPluginEslintComments.configs.recommended.rules
112
- }
113
- }
114
- ],
115
- languageOptions: {
116
- // global parser options
117
- parserOptions: {
118
- ecmaVersion,
119
- sourceType: "module"
120
- }
121
- },
122
- linterOptions: {
123
- reportUnusedDisableDirectives: "warn"
124
- },
125
- plugins: {
126
- "@eslint-community/eslint-comments": eslintPluginEslintComments
127
- }
128
- },
129
-
130
- {
131
- name: "@haltcase/internal/Best practices",
132
- files: allSupportedFiles,
133
- rules: bestPracticeRules
134
- },
135
-
136
- ...eslintEs2015Config,
137
-
138
- {
139
- name: "@haltcase/internal/Imports",
140
- files: allSupportedFiles,
141
- rules: importRules
142
- },
143
-
144
- {
145
- name: "@haltcase/internal/Possible errors",
146
- files: allSupportedFiles,
147
- rules: possibleErrorsRules
148
- },
149
-
150
- {
151
- name: "@haltcase/internal/Regular Expressions",
152
- // eslint-disable-next-line import-x/no-named-as-default-member
153
- ...eslintRegexp.configs["flat/recommended"]
154
- },
155
-
156
- ...eslintSimpleImportSortConfig,
157
-
158
- {
159
- name: "@haltcase/internal/Stylistic",
160
- files: allSupportedFiles,
161
- rules: stylisticRules
162
- },
163
-
164
- ...eslintUnicornConfig,
165
-
166
- {
167
- name: "@haltcase/internal/Variables",
168
- // files: allSupportedFiles,
169
- rules: variablesRules
170
- },
171
-
172
- {
173
- name: "@haltcase/internal/JavaScript files",
174
- files: javascriptFiles,
175
- languageOptions: {
176
- parser: babelParser,
177
- parserOptions: {
178
- requireConfigFile: false
179
- }
180
- }
181
- },
182
-
183
- ...getEslintTypescriptConfigInternal({ ...options, internal: true }),
184
-
185
- {
186
- name: "@haltcase/internal/Third-party config files (e.g., next.config.mjs)",
187
- files: configFiles,
188
- rules: {
189
- // these files likely require default exports
190
- "import-x/no-default-export": "off"
191
- }
192
- },
193
-
194
- {
195
- name: "@haltcase/internal/Development-only helper scripts & Prisma database scripts",
196
- files: scriptFiles,
197
- rules: {
198
- "no-console": "off",
199
- "unicorn/no-process-exit": "off"
200
- }
201
- },
202
-
203
- ...getEslintCommonJsConfigInternal(options)
204
- );
205
- };
@@ -1,22 +0,0 @@
1
- import { config } from "typescript-eslint";
2
-
3
- import { commonJsFiles, commonJsOnlyFiles } from "../../constants.js";
4
-
5
- /**
6
- * @type {import("./base.js").HaltcaseStyleCreator}
7
- */
8
- export const getEslintCommonJsConfigInternal = (options = {}) =>
9
- config({
10
- name: "@haltcase/internal/CommonJS files",
11
-
12
- files: options.commonjs ? commonJsFiles : commonJsOnlyFiles,
13
- languageOptions: {
14
- parserOptions: {
15
- sourceType: "script"
16
- }
17
- },
18
- rules: {
19
- strict: ["error", "global"],
20
- "unicorn/prefer-module": "off"
21
- }
22
- });
@@ -1,72 +0,0 @@
1
- import { config } from "typescript-eslint";
2
-
3
- /**
4
- * @type {ReturnType<import("./base.js").HaltcaseStyleCreator>}
5
- */
6
- export const eslintEs2015Config = config({
7
- name: "@haltcase/internal/ES2015",
8
-
9
- rules: {
10
- /**
11
- * Disallow useless computed property keys.
12
- *
13
- * 🔧 Fixable - https://eslint.org/docs/rules/no-useless-computed-key
14
- */
15
- "no-useless-computed-key": "warn",
16
- /**
17
- * Disallow renaming import, export, and destructured assignments to the
18
- * same name.
19
- *
20
- * 🔧 Fixable - https://eslint.org/docs/rules/no-useless-rename
21
- */
22
- "no-useless-rename": "warn",
23
- /**
24
- * Require `let` or `const` instead of `var`.
25
- *
26
- * 🔧 Fixable - https://eslint.org/docs/rules/no-var
27
- */
28
- "no-var": "error",
29
- /**
30
- * Require object literal shorthand syntax.
31
- *
32
- * 🔧 Fixable - https://eslint.org/docs/rules/object-shorthand
33
- */
34
- "object-shorthand": "warn",
35
- /**
36
- * Require default to `const` instead of `let`.
37
- *
38
- * 🔧 Fixable - https://eslint.org/docs/rules/prefer-const
39
- */
40
- "prefer-const": "warn",
41
- /**
42
- * Disallow parseInt() in favor of binary, octal, and hexadecimal literals.
43
- *
44
- * 🔧 Fixable - https://eslint.org/docs/rules/prefer-numeric-literals
45
- */
46
- "prefer-numeric-literals": "error",
47
- /**
48
- * Require using rest parameters instead of `arguments`.
49
- *
50
- * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-rest-params
51
- */
52
- "prefer-rest-params": "error",
53
- /**
54
- * Require using spread syntax instead of `.apply()`.
55
- *
56
- * 🚫 Not fixable - https://eslint.org/docs/rules/prefer-spread
57
- */
58
- "prefer-spread": "error",
59
- /**
60
- * Require using template literals instead of string concatenation.
61
- *
62
- * 🔧 Fixable - https://eslint.org/docs/rules/prefer-template
63
- */
64
- "prefer-template": "warn",
65
- /**
66
- * Require a `Symbol` description.
67
- *
68
- * 🚫 Not fixable - https://eslint.org/docs/rules/symbol-description
69
- */
70
- "symbol-description": "error"
71
- }
72
- });
@@ -1,27 +0,0 @@
1
- import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort";
2
- import { config } from "typescript-eslint";
3
-
4
- /**
5
- * @type {ReturnType<import("./base.js").HaltcaseStyleCreator>}
6
- */
7
- export const eslintSimpleImportSortConfig = config({
8
- name: "@haltcase/internal/Import & export sorting",
9
-
10
- plugins: {
11
- "simple-import-sort": eslintPluginSimpleImportSort
12
- },
13
- rules: {
14
- /**
15
- * Enforce export sort order.
16
- *
17
- * 🔧 Fixable - https://github.com/lydell/eslint-plugin-simple-import-sort#exports
18
- */
19
- "simple-import-sort/exports": "error",
20
- /**
21
- * Enforce import sort order.
22
- *
23
- * 🔧 Fixable - https://github.com/lydell/eslint-plugin-simple-import-sort#imports
24
- */
25
- "simple-import-sort/imports": "error"
26
- }
27
- });
@@ -1,20 +0,0 @@
1
- import eslintPluginTsdoc from "eslint-plugin-tsdoc";
2
- import { config } from "typescript-eslint";
3
-
4
- /**
5
- * @type {ReturnType<import("./base.js").HaltcaseStyleCreator>}
6
- */
7
- export const eslintTsdocConfig = config({
8
- name: "@haltcase/internal/TSDoc comments",
9
- plugins: {
10
- tsdoc: eslintPluginTsdoc
11
- },
12
- rules: {
13
- /**
14
- * Require TSDoc comments conform to the TSDoc specification.
15
- *
16
- * 🚫 Not fixable - https://github.com/microsoft/tsdoc/tree/master/eslint-plugin
17
- */
18
- "tsdoc/syntax": "error"
19
- }
20
- });