@haltcase/style 8.0.0-canary.9 → 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 -174
  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,53 +0,0 @@
1
- /**
2
- * @import { type TypeScriptResolverOptions } from "eslint-import-resolver-typescript"
3
- */
4
-
5
- /**
6
- * @typedef {Object} TypeScriptProjectConfig
7
- * @property {import("@typescript-eslint/types").ParserOptions} parserOptions
8
- * @property {TypeScriptResolverOptions} resolverOptions
9
- */
10
-
11
- /**
12
- * @param {import("../base").TypeScriptProjectOptions} projectInput
13
- * @returns {TypeScriptProjectConfig}
14
- */
15
- export const prepareTypeScriptProjectConfig = (projectInput) => {
16
- // eslint-disable-next-line unicorn/prefer-default-parameters -- default parameters don't handle `null`
17
- const project = projectInput ?? true;
18
-
19
- if (typeof project === "string" || Array.isArray(project)) {
20
- return {
21
- parserOptions: {
22
- project
23
- },
24
- resolverOptions: {
25
- project
26
- }
27
- };
28
- }
29
-
30
- if (typeof project === "object" && project !== null) {
31
- return {
32
- parserOptions: {
33
- projectService: project.projectService
34
- },
35
- resolverOptions: {
36
- project: project.tsconfigPaths
37
- }
38
- };
39
- }
40
-
41
- if (typeof project !== "boolean") {
42
- throw new TypeError(
43
- "Invariant violation: expected project to be a boolean"
44
- );
45
- }
46
-
47
- return {
48
- parserOptions: {
49
- project
50
- },
51
- resolverOptions: {}
52
- };
53
- };
@@ -1,54 +0,0 @@
1
- import pluginNextjs from "@next/eslint-plugin-next";
2
- import { config } from "typescript-eslint";
3
-
4
- import {
5
- allSupportedFiles,
6
- nextJsApiRoutes,
7
- nextJsMetadataFiles,
8
- nextJsPageFiles
9
- } from "../constants.js";
10
- import { getEslintBaseConfig } from "./internal/base.js";
11
- import { getEslintNodeConfigInternal } from "./node.js";
12
- import { getEslintReactConfigInternal } from "./react.js";
13
-
14
- // Remove this when `@next/eslint-plugin-next` is ESM and typed properly
15
- // eslint-disable-next-line import-x/no-named-as-default-member
16
- const nextJsConfigs = pluginNextjs.configs;
17
-
18
- /**
19
- * @type {import("./internal/base.js").HaltcaseStyleCreator}
20
- */
21
- export const getEslintNextConfig = (options = {}) =>
22
- config(
23
- ...getEslintBaseConfig(options),
24
- ...getEslintNodeConfigInternal(options),
25
- ...getEslintNextConfigInternal(options)
26
- );
27
-
28
- /**
29
- * @type {import("./internal/base.js").HaltcaseStyleCreator}
30
- */
31
- export const getEslintNextConfigInternal = (options = {}) =>
32
- config(
33
- ...getEslintReactConfigInternal(options),
34
- {
35
- name: "@haltcase/nextjs",
36
-
37
- files: allSupportedFiles,
38
- plugins: {
39
- "@next/next": pluginNextjs
40
- },
41
- rules: {
42
- ...nextJsConfigs.recommended.rules,
43
- ...nextJsConfigs["core-web-vitals"].rules
44
- }
45
- },
46
- {
47
- name: "Next.js page files and API routes",
48
-
49
- files: [...nextJsPageFiles, ...nextJsApiRoutes, ...nextJsMetadataFiles],
50
- rules: {
51
- "import-x/no-default-export": "off"
52
- }
53
- }
54
- );
@@ -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 getEslintNodeConfig = (options = {}) =>
10
- config(
11
- ...getEslintNodeConfigInternal(options),
12
- ...getEslintBaseConfig(options)
13
- );
14
-
15
- /**
16
- * @type {import("./internal/base.js").HaltcaseStyleCreator}
17
- */
18
- export const getEslintNodeConfigInternal = (_options = {}) =>
19
- config({
20
- name: "@haltcase/Node.js",
21
-
22
- languageOptions: {
23
- globals: {
24
- ...globals.node
25
- }
26
- }
27
- });
@@ -1,21 +0,0 @@
1
- import eslintPluginPlaywright from "eslint-plugin-playwright";
2
- import { config } from "typescript-eslint";
3
-
4
- import { playwrightTestRules } from "../rules/playwright-test.js";
5
-
6
- const playwrightRecommendedConfig =
7
- eslintPluginPlaywright.configs["flat/recommended"];
8
-
9
- /**
10
- * @type {import("./internal/base.js").HaltcaseStyleCreator}
11
- */
12
- export const getEslintPlaywrightTestConfig = (_options = {}) =>
13
- config({
14
- ...playwrightRecommendedConfig,
15
-
16
- name: "Playwright tests",
17
-
18
- rules: {
19
- ...playwrightTestRules
20
- }
21
- });
@@ -1,114 +0,0 @@
1
- import eslintPluginReact from "@eslint-react/eslint-plugin";
2
- import eslintStylisticJsx from "@stylistic/eslint-plugin-jsx";
3
- import * as eslintPluginImportX from "eslint-plugin-import-x";
4
- import eslintPluginJsxA11y from "eslint-plugin-jsx-a11y";
5
- import eslintPluginReactOriginal from "eslint-plugin-react";
6
- // eslint-disable-next-line import-x/default
7
- import eslintPluginReactHooks from "eslint-plugin-react-hooks";
8
- import { config } from "typescript-eslint";
9
-
10
- import { jsxFiles, typescriptJsxFiles } from "../constants.js";
11
- import { jsxA11yRules } from "../rules/jsx-a11y.js";
12
- import { reactRules } from "../rules/react.js";
13
- import { reactXRules } from "../rules/react-x.js";
14
- import { stylisticJsxRules } from "../rules/stylistic-jsx.js";
15
- import { getEslintBaseConfig } from "./internal/base.js";
16
-
17
- /**
18
- * @type {import("./internal/base.js").HaltcaseStyleCreator}
19
- */
20
- export const getEslintReactConfig = (options) =>
21
- config(
22
- ...getEslintBaseConfig(options),
23
- ...getEslintReactConfigInternal(options)
24
- );
25
-
26
- /**
27
- * @type {import("./internal/base.js").HaltcaseStyleCreator}
28
- */
29
- export const getEslintReactConfigInternal = (_options = {}) =>
30
- config(
31
- {
32
- name: "@haltcase/react",
33
-
34
- files: jsxFiles,
35
-
36
- extends: [
37
- {
38
- name: "@haltcase/react/jsx-eslint/react",
39
- plugins: {
40
- react: eslintPluginReactOriginal
41
- },
42
- rules: {
43
- ...reactRules
44
- }
45
- },
46
-
47
- {
48
- name: "@haltcase/react/stylistic",
49
- plugins: {
50
- "@stylistic/jsx": eslintStylisticJsx
51
- },
52
- rules: {
53
- ...stylisticJsxRules
54
- }
55
- },
56
-
57
- {
58
- name: "@haltcase/react/hooks",
59
- plugins: {
60
- "react-hooks": eslintPluginReactHooks
61
- },
62
- rules: {
63
- ...eslintPluginReactHooks.configs.recommended.rules
64
- }
65
- },
66
-
67
- {
68
- name: "@haltcase/react/jsx-a11y",
69
- ...eslintPluginJsxA11y.flatConfigs.recommended
70
- },
71
-
72
- {
73
- name: "@haltcase/react/import-x",
74
- ...eslintPluginImportX.flatConfigs.react,
75
-
76
- // the base config already defines the `import-x` plugin, and if we
77
- // don't omit it from this config, we get the error:
78
- // Cannot redefine plugin "import-x"
79
- plugins: {}
80
- }
81
- ],
82
- settings: {
83
- react: {
84
- version: "detect"
85
- }
86
- },
87
-
88
- rules: {
89
- ...jsxA11yRules
90
- }
91
- },
92
-
93
- {
94
- ...eslintPluginReact.configs.recommended,
95
-
96
- name: "@haltcase/react/recommended",
97
-
98
- files: typescriptJsxFiles,
99
- rules: {
100
- ...reactXRules
101
- }
102
- },
103
-
104
- {
105
- ...eslintPluginReact.configs["recommended-type-checked"],
106
-
107
- name: "@haltcase/react/recommended-type-checked",
108
-
109
- files: typescriptJsxFiles,
110
- rules: {
111
- ...reactXRules
112
- }
113
- }
114
- );
@@ -1,125 +0,0 @@
1
- import eslintConfigPrettier from "eslint-config-prettier";
2
- import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
3
- import * as eslintPluginImportX from "eslint-plugin-import-x";
4
- import { config, configs, parser, plugin } from "typescript-eslint";
5
-
6
- import { typescriptFiles, typescriptJsxFiles } from "../constants.js";
7
- import { typescriptExtensionRules } from "../rules/typescript/extension.js";
8
- import { typescriptImportRules } from "../rules/typescript/import.js";
9
- import { typescriptBaseRules } from "../rules/typescript/index.js";
10
- import { getTypescriptNamingConventionRule } from "../rules/typescript/naming-convention.js";
11
- import { eslintTsdocConfig } from "./internal/tsdoc.js";
12
- import { prepareTypeScriptProjectConfig } from "./internal/utils/typescript.js";
13
-
14
- /**
15
- * @type {import("./internal/base.js").HaltcaseStyleCreator}
16
- */
17
- export const getEslintTypescriptConfig = (options = {}) =>
18
- getEslintTypescriptConfigInternal(options);
19
-
20
- /**
21
- * @type {(options?: import("./internal/base.js").HaltcaseStyleOptions & {internal?: boolean}) => Awaited<import("typescript-eslint").Config>}
22
- */
23
- export const getEslintTypescriptConfigInternal = (options = {}) => {
24
- const { parserOptions, resolverOptions } = prepareTypeScriptProjectConfig(
25
- options.typescriptProject
26
- );
27
-
28
- /** @type {import("typescript-eslint").ConfigWithExtends["languageOptions"]} */
29
- const languageOptions = {
30
- parser,
31
- parserOptions: {
32
- ecmaFeatures: {
33
- jsx: options.react || undefined,
34
- modules: true
35
- },
36
- // https://github.com/typescript-eslint/typescript-eslint/issues/3788#issuecomment-905094436
37
- jsxPragma: null,
38
- ...parserOptions
39
- }
40
- };
41
-
42
- return config(
43
- {
44
- name: "@haltcase/internal/TypeScript files",
45
-
46
- files: typescriptFiles,
47
-
48
- extends: [
49
- ...configs.recommendedTypeChecked,
50
- ...configs.strictTypeChecked,
51
- ...configs.stylisticTypeChecked,
52
-
53
- {
54
- name: "import-x/typescript",
55
- ...eslintPluginImportX.flatConfigs.typescript,
56
-
57
- // the base config already defines the `import-x` plugin, and if we
58
- // don't omit it from this config, we get the error:
59
- // Cannot redefine plugin "import-x"
60
- plugins: {}
61
- },
62
-
63
- { name: "prettier", ...eslintConfigPrettier },
64
-
65
- ...eslintTsdocConfig
66
- ],
67
-
68
- languageOptions,
69
-
70
- rules: {
71
- ...typescriptBaseRules,
72
- ...typescriptExtensionRules,
73
- ...typescriptImportRules,
74
- ...getTypescriptNamingConventionRule()
75
- },
76
-
77
- settings: {
78
- "import-x/resolver-next": [
79
- createTypeScriptImportResolver({
80
- ...resolverOptions
81
- })
82
- ]
83
- }
84
- },
85
- {
86
- name: "@haltcase/internal/TypeScript TSX files",
87
-
88
- files: typescriptJsxFiles,
89
- languageOptions,
90
-
91
- plugins: {
92
- "@typescript-eslint": plugin
93
- },
94
-
95
- rules: {
96
- ...getTypescriptNamingConventionRule({
97
- isTsx: true
98
- })
99
- }
100
- },
101
- {
102
- // special accommodations for non-TSX component-like files;
103
- // specifically, this was added to allow PascaleCase'd declarations
104
- // of extended components with Mantine, which uses e.g., `Button.extend()`
105
- // to create a customized instance of a UI component
106
- name: "@haltcase/internal/TypeScript component files",
107
-
108
- files: [
109
- "**/components/**/*.ts",
110
- ...(options.typescriptComponentPaths ?? [])
111
- ],
112
- languageOptions,
113
-
114
- plugins: {
115
- "@typescript-eslint": plugin
116
- },
117
-
118
- rules: {
119
- ...getTypescriptNamingConventionRule({
120
- isComponentLike: true
121
- })
122
- }
123
- }
124
- );
125
- };
@@ -1,27 +0,0 @@
1
- export const ecmaVersion = 2021;
2
-
3
- export const commonJsOnlyFiles = ["**/*.cjs"];
4
- export const commonJsFiles = ["**/*.{c,}js"];
5
- export const javascriptFiles = ["**/*.{m,}js{x,}"];
6
- export const typescriptFiles = ["**/*.{m,}ts{x,}"];
7
- export const javascriptJsxFiles = ["**/*.{m,}jsx"];
8
- export const typescriptJsxFiles = ["**/*.{m,}tsx"];
9
- export const jsxFiles = ["**/*.{c,m,}{js,ts}x"];
10
-
11
- export const configFiles = ["**/*.config.{m,}{js,ts}"];
12
- export const scriptFiles = ["**/scripts/*", "**/prisma/*"];
13
-
14
- export const nextJsPageFiles = ["**/{pages,app}/**/*.{m,}{js,ts}x"];
15
- export const nextJsApiRoutes = [
16
- "**/pages/api/**/*.{m,}{js,ts}",
17
- "**/app/**/route.{m,}{js,ts}x"
18
- ];
19
- export const nextJsMetadataFiles = [
20
- "**/app/{apple-,}icon.{js,ts}x",
21
- "**/app/manifest.{js,ts}",
22
- "**/app/robots.{js,ts}",
23
- "**/app/sitemap.{js,ts}",
24
- "**/app/{opengraph,twitter}-image.{js,ts}x"
25
- ];
26
-
27
- export const allSupportedFiles = ["**/*.{c,m,}{js,ts}{x,}"];
package/eslint/index.js DELETED
@@ -1,33 +0,0 @@
1
- import { config } from "typescript-eslint";
2
-
3
- import { getEslintBrowserConfigInternal } from "./configs/browser.js";
4
- import { getEslintBaseConfig } from "./configs/internal/base.js";
5
- import { getEslintNextConfigInternal } from "./configs/next.js";
6
- import { getEslintNodeConfigInternal } from "./configs/node.js";
7
- import { getEslintReactConfigInternal } from "./configs/react.js";
8
-
9
- /**
10
- * @type {import("./configs/internal/base.js").HaltcaseStyleCreator}
11
- */
12
- export const getEslintConfig = (options = {}) =>
13
- config(
14
- ...getEslintBaseConfig(options),
15
- ...(options.browser ? getEslintBrowserConfigInternal(options) : []),
16
- ...(options.node ? getEslintNodeConfigInternal(options) : []),
17
-
18
- ...(options.nextjs ? getEslintNextConfigInternal(options) : []),
19
- ...(options.react && !options.nextjs
20
- ? getEslintReactConfigInternal(options)
21
- : [])
22
- );
23
-
24
- // eslint-disable-next-line import-x/no-default-export
25
- export default getEslintConfig;
26
-
27
- export { getEslintBrowserConfig } from "./configs/browser.js";
28
- export { getEslintCommonJsConfig } from "./configs/cjs.js";
29
- export { getEslintNextConfig } from "./configs/next.js";
30
- export { getEslintNodeConfig } from "./configs/node.js";
31
- export { getEslintReactConfig } from "./configs/react.js";
32
- export { getEslintTypescriptConfig } from "./configs/typescript.js";
33
- export { withFiles } from "./withFiles.js";