@haltcase/style 8.0.0-canary.2 → 8.0.0-canary.6

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.
@@ -1,3 +1,13 @@
1
+ /**
2
+ * @typedef {Object} TypeScriptProjectServiceOptions
3
+ * @property {true} projectService Use the TypeScript ESLint [project service](https://typescript-eslint.io/packages/parser#projectservice).
4
+ * @property {string | string[] | undefined} [tsconfigPaths] Paths to tsconfig.json files for resolving and linting imports.
5
+ * This defaults to `<root>/tsconfig.json` or `<root>/jsconfig.json` and
6
+ * [project references](https://www.typescriptlang.org/docs/handbook/project-references.html) are supported.
7
+ */
8
+ /**
9
+ * @typedef {ParserOptions["project"] | TypeScriptProjectServiceOptions} TypeScriptProjectOptions
10
+ */
1
11
  /**
2
12
  * @typedef {Object} HaltcaseStyleOptions
3
13
  * @property {boolean} [browser] Whether to include browser rules and globals.
@@ -5,10 +15,9 @@
5
15
  * @property {boolean} [nextjs] Whether to include Next.js rules (implies `react`).
6
16
  * @property {boolean} [node] Whether to include Node.js rules.
7
17
  * @property {boolean} [react] Whether to include React rules.
8
- * @property {ParserOptions["project"]} [typescriptProject = true] Custom TypeScript project options for the `typescript-eslint` parser.
9
- * // use when VS Code supports `projectService`
10
- * // https://github.com/microsoft/vscode-eslint/issues/1911
11
- * property {ProjectServiceOptions} [typescriptProjectServiceOptions = true] Custom TypeScript project service options for the `typescript-eslint` parser.
18
+ * @property {string[]} [typescriptComponentPaths] Additional paths to consider as TypeScript component files.
19
+ * @property {TypeScriptProjectOptions} [typescriptProject] Custom TypeScript project options for
20
+ * the `typescript-eslint` parser and `eslint-import-resolver-typescript`.
12
21
  */
13
22
  /**
14
23
  * @typedef {(options?: HaltcaseStyleOptions) => Awaited<import("typescript-eslint").Config>} HaltcaseStyleCreator
@@ -19,6 +28,19 @@
19
28
  * @type {HaltcaseStyleCreator}
20
29
  */
21
30
  export const getEslintBaseConfig: HaltcaseStyleCreator;
31
+ export type TypeScriptProjectServiceOptions = {
32
+ /**
33
+ * Use the TypeScript ESLint [project service](https://typescript-eslint.io/packages/parser#projectservice).
34
+ */
35
+ projectService: true;
36
+ /**
37
+ * Paths to tsconfig.json files for resolving and linting imports.
38
+ * This defaults to `<root>/tsconfig.json` or `<root>/jsconfig.json` and
39
+ * [project references](https://www.typescriptlang.org/docs/handbook/project-references.html) are supported.
40
+ */
41
+ tsconfigPaths?: string | string[] | undefined;
42
+ };
43
+ export type TypeScriptProjectOptions = ParserOptions["project"] | TypeScriptProjectServiceOptions;
22
44
  export type HaltcaseStyleOptions = {
23
45
  /**
24
46
  * Whether to include browser rules and globals.
@@ -41,12 +63,14 @@ export type HaltcaseStyleOptions = {
41
63
  */
42
64
  react?: boolean | undefined;
43
65
  /**
44
- * Custom TypeScript project options for the `typescript-eslint` parser.
45
- * // use when VS Code supports `projectService`
46
- * // https://github.com/microsoft/vscode-eslint/issues/1911
47
- * property {ProjectServiceOptions} [typescriptProjectServiceOptions = true] Custom TypeScript project service options for the `typescript-eslint` parser.
66
+ * Additional paths to consider as TypeScript component files.
67
+ */
68
+ typescriptComponentPaths?: string[] | undefined;
69
+ /**
70
+ * Custom TypeScript project options for
71
+ * the `typescript-eslint` parser and `eslint-import-resolver-typescript`.
48
72
  */
49
- typescriptProject?: ParserOptions["project"];
73
+ typescriptProject?: TypeScriptProjectOptions;
50
74
  };
51
75
  export type HaltcaseStyleCreator = (options?: HaltcaseStyleOptions) => Awaited<import("typescript-eslint").Config>;
52
76
  import type { ParserOptions } from "@typescript-eslint/types";
@@ -0,0 +1,6 @@
1
+ export function prepareTypeScriptProjectConfig(projectInput: import("../base").TypeScriptProjectOptions): TypeScriptProjectConfig;
2
+ export type TypeScriptProjectConfig = {
3
+ parserOptions: import("@typescript-eslint/types").ParserOptions;
4
+ resolverOptions: TypeScriptResolverOptions;
5
+ };
6
+ import type { TypeScriptResolverOptions } from "eslint-import-resolver-typescript";
@@ -1,11 +1,12 @@
1
1
  /**
2
- * @import { ParserOptions } from "@typescript-eslint/types"
2
+ * @import { type ParserOptions } from "@typescript-eslint/types"
3
3
  */
4
4
 
5
5
  import babelParser from "@babel/eslint-parser";
6
6
  import eslint from "@eslint/js";
7
7
  import eslintPluginEslintComments from "@eslint-community/eslint-plugin-eslint-comments";
8
8
  import eslintConfigPrettier from "eslint-config-prettier";
9
+ import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
9
10
  import * as eslintPluginImportX from "eslint-plugin-import-x";
10
11
  import eslintRegexp from "eslint-plugin-regexp";
11
12
  import { config } from "typescript-eslint";
@@ -27,6 +28,19 @@ import { getEslintCommonJsConfigInternal } from "./commonjs.js";
27
28
  import { eslintEs2015Config } from "./es2015.js";
28
29
  import { eslintSimpleImportSortConfig } from "./simple-import-sort.js";
29
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
+ */
30
44
 
31
45
  /**
32
46
  * @typedef {Object} HaltcaseStyleOptions
@@ -35,7 +49,12 @@ import { eslintUnicornConfig } from "./unicorn.js";
35
49
  * @property {boolean} [nextjs] Whether to include Next.js rules (implies `react`).
36
50
  * @property {boolean} [node] Whether to include Node.js rules.
37
51
  * @property {boolean} [react] Whether to include React rules.
38
- * @property {ParserOptions["project"]} [typescriptProject = true] Custom TypeScript project options for the `typescript-eslint` parser.
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
+ /*
39
58
  * // use when VS Code supports `projectService`
40
59
  * // https://github.com/microsoft/vscode-eslint/issues/1911
41
60
  * property {ProjectServiceOptions} [typescriptProjectServiceOptions = true] Custom TypeScript project service options for the `typescript-eslint` parser.
@@ -50,8 +69,12 @@ import { eslintUnicornConfig } from "./unicorn.js";
50
69
  *
51
70
  * @type {HaltcaseStyleCreator}
52
71
  */
53
- export const getEslintBaseConfig = (options = {}) =>
54
- config(
72
+ export const getEslintBaseConfig = (options = {}) => {
73
+ const { resolverOptions } = prepareTypeScriptProjectConfig(
74
+ options.typescriptProject
75
+ );
76
+
77
+ return config(
55
78
  {
56
79
  name: "import-x/recommended",
57
80
  plugins: {
@@ -64,10 +87,13 @@ export const getEslintBaseConfig = (options = {}) =>
64
87
  "import-x/parsers": {
65
88
  "@typescript-eslint/parser": [".ts"]
66
89
  },
67
- "import-x/resolver": {
68
- typescript: true,
69
- node: true
70
- }
90
+ "import-x/resolver-next": [
91
+ createTypeScriptImportResolver({
92
+ ...resolverOptions
93
+ }),
94
+
95
+ eslintPluginImportX.createNodeResolver()
96
+ ]
71
97
  }
72
98
  },
73
99
 
@@ -176,3 +202,4 @@ export const getEslintBaseConfig = (options = {}) =>
176
202
 
177
203
  ...getEslintCommonJsConfigInternal(options)
178
204
  );
205
+ };
@@ -119,6 +119,12 @@ export const eslintUnicornConfig = config({
119
119
  * 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-reduce.md
120
120
  */
121
121
  "unicorn/no-array-reduce": "off",
122
+ /**
123
+ * Prefer `Array#toReversed()` over `Array#reverse()`.
124
+ *
125
+ * 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-reverse.md
126
+ */
127
+ "unicorn/no-array-reverse": "error",
122
128
  /**
123
129
  * Disallow member access from await expression.
124
130
  *
@@ -289,6 +295,12 @@ export const eslintUnicornConfig = config({
289
295
  * 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-unused-properties.md
290
296
  */
291
297
  "unicorn/no-unused-properties": "error",
298
+ /**
299
+ * Disallow unnecessary `Error.captureStackTrace(…)`.
300
+ *
301
+ * 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-error-capture-stack-trace.md
302
+ */
303
+ "unicorn/no-useless-error-capture-stack-trace": "error",
292
304
  /**
293
305
  * Disallow useless fallback when spreading in object literals.
294
306
  *
@@ -391,6 +403,12 @@ export const eslintUnicornConfig = config({
391
403
  * 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-blob-reading-methods.md
392
404
  */
393
405
  "unicorn/prefer-blob-reading-methods": "error",
406
+ /**
407
+ * Prefer class field declarations over `this` assignments in constructors.
408
+ *
409
+ * 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-class-fields.md
410
+ */
411
+ "unicorn/prefer-class-fields": "error",
394
412
  /**
395
413
  * Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`.
396
414
  *
@@ -677,6 +695,12 @@ export const eslintUnicornConfig = config({
677
695
  * 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-array-join-separator.md
678
696
  */
679
697
  "unicorn/require-array-join-separator": "error",
698
+ /**
699
+ * Require non-empty specifier list in import and export statements.
700
+ *
701
+ * 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/require-module-specifiers.md
702
+ */
703
+ "unicorn/require-module-specifiers": "error",
680
704
  /**
681
705
  * Enforce using the digits argument with `Number#toFixed()`.
682
706
  *
@@ -0,0 +1,53 @@
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
+ };
@@ -11,6 +11,10 @@ import { getEslintBaseConfig } from "./internal/base.js";
11
11
  import { getEslintNodeConfigInternal } from "./node.js";
12
12
  import { getEslintReactConfigInternal } from "./react.js";
13
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
+
14
18
  /**
15
19
  * @type {import("./internal/base.js").HaltcaseStyleCreator}
16
20
  */
@@ -35,8 +39,8 @@ export const getEslintNextConfigInternal = (options = {}) =>
35
39
  "@next/next": pluginNextjs
36
40
  },
37
41
  rules: {
38
- ...pluginNextjs.configs.recommended.rules,
39
- ...pluginNextjs.configs["core-web-vitals"].rules
42
+ ...nextJsConfigs.recommended.rules,
43
+ ...nextJsConfigs["core-web-vitals"].rules
40
44
  }
41
45
  },
42
46
  {
@@ -1,4 +1,5 @@
1
1
  import eslintConfigPrettier from "eslint-config-prettier";
2
+ import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
2
3
  import * as eslintPluginImportX from "eslint-plugin-import-x";
3
4
  import { config, configs, parser, plugin } from "typescript-eslint";
4
5
 
@@ -8,6 +9,7 @@ import { typescriptImportRules } from "../rules/typescript/import.js";
8
9
  import { typescriptBaseRules } from "../rules/typescript/index.js";
9
10
  import { getTypescriptNamingConventionRule } from "../rules/typescript/naming-convention.js";
10
11
  import { eslintTsdocConfig } from "./internal/tsdoc.js";
12
+ import { prepareTypeScriptProjectConfig } from "./internal/utils/typescript.js";
11
13
 
12
14
  /**
13
15
  * @type {import("./internal/base.js").HaltcaseStyleCreator}
@@ -19,6 +21,10 @@ export const getEslintTypescriptConfig = (options = {}) =>
19
21
  * @type {(options?: import("./internal/base.js").HaltcaseStyleOptions & {internal?: boolean}) => Awaited<import("typescript-eslint").Config>}
20
22
  */
21
23
  export const getEslintTypescriptConfigInternal = (options = {}) => {
24
+ const { parserOptions, resolverOptions } = prepareTypeScriptProjectConfig(
25
+ options.typescriptProject
26
+ );
27
+
22
28
  /** @type {import("typescript-eslint").ConfigWithExtends["languageOptions"]} */
23
29
  const languageOptions = {
24
30
  parser,
@@ -29,10 +35,7 @@ export const getEslintTypescriptConfigInternal = (options = {}) => {
29
35
  },
30
36
  // https://github.com/typescript-eslint/typescript-eslint/issues/3788#issuecomment-905094436
31
37
  jsxPragma: null,
32
- project: options.typescriptProject ?? true
33
- // use `projectService` when VS Code supports it properly
34
- // https://github.com/microsoft/vscode-eslint/issues/1911
35
- // projectService: options.typescriptProjectServiceOptions ?? true
38
+ ...parserOptions
36
39
  }
37
40
  };
38
41
 
@@ -72,9 +75,11 @@ export const getEslintTypescriptConfigInternal = (options = {}) => {
72
75
  },
73
76
 
74
77
  settings: {
75
- "import-x/resolver": {
76
- typescript: true
77
- }
78
+ "import-x/resolver-next": [
79
+ createTypeScriptImportResolver({
80
+ ...resolverOptions
81
+ })
82
+ ]
78
83
  }
79
84
  },
80
85
  {
@@ -100,7 +105,10 @@ export const getEslintTypescriptConfigInternal = (options = {}) => {
100
105
  // to create a customized instance of a UI component
101
106
  name: "@haltcase/internal/TypeScript component files",
102
107
 
103
- files: ["**/components/**/*.ts"],
108
+ files: [
109
+ "**/components/**/*.ts",
110
+ ...(options.typescriptComponentPaths ?? [])
111
+ ],
104
112
  languageOptions,
105
113
 
106
114
  plugins: {
@@ -49,7 +49,7 @@ export const getTypescriptNamingConventionRule = ({
49
49
  regex: "^(ALL|GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS)$"
50
50
  },
51
51
  format: null,
52
- selector: ["variableLike"]
52
+ selector: ["variableLike", "memberLike"]
53
53
  },
54
54
  // allow variable-likes called exactly "_"
55
55
  {
package/package.json CHANGED
@@ -1,173 +1,165 @@
1
1
  {
2
- "name": "@haltcase/style",
3
- "version": "8.0.0-canary.2",
4
- "description": "haltcase's web ecosystem style guide & configurations",
5
- "keywords": [
6
- "eslint",
7
- "prettier",
8
- "typescript",
9
- "style",
10
- "eslint-config"
11
- ],
12
- "homepage": "https://github.com/haltcase/style#readme",
13
- "bugs": "https://github.com/haltcase/style/issues",
14
- "repository": {
15
- "type": "git",
16
- "url": "https://github.com/haltcase/style.git"
17
- },
18
- "license": "MPL-2.0",
19
- "author": "Bo Lingen <bo@haltcase.dev> (https://haltcase.dev)",
20
- "type": "module",
21
- "exports": {
22
- "./eslint": {
23
- "types": "./dist/types/eslint/index.d.ts",
24
- "default": "./eslint/index.js"
25
- },
26
- "./eslint/rules/*": {
27
- "types": "./dist/types/eslint/rules/*.d.ts",
28
- "default": "./eslint/rules/*.js"
29
- },
30
- "./eslint/rules/typescript": {
31
- "types": "./dist/types/eslint/rules/typescript/index.d.ts",
32
- "default": "./eslint/rules/typescript/index.js"
33
- },
34
- "./prettier": {
35
- "types": "./dist/types/prettier/index.d.ts",
36
- "default": "./prettier/index.js"
37
- },
38
- "./stylelint": {
39
- "types": "./dist/types/stylelint/index.d.ts",
40
- "default": "./stylelint/index.js"
41
- },
42
- "./stylelint/modules": {
43
- "types": "./dist/types/stylelint/modules.d.ts",
44
- "default": "./stylelint/modules.js"
45
- },
46
- "./stylelint/standard": {
47
- "types": "./dist/types/stylelint/standard.d.ts",
48
- "default": "./stylelint/standard.js"
49
- },
50
- "./stylelint/tailwind": {
51
- "types": "./dist/types/stylelint/tailwind.d.ts",
52
- "default": "./stylelint/tailwind.js"
53
- },
54
- "./typescript/base": "./typescript/tsconfig.base.json",
55
- "./typescript/bundler": "./typescript/tsconfig.bundler.json",
56
- "./typescript/next": "./typescript/tsconfig.next.json",
57
- "./typescript/node": "./typescript/tsconfig.node.json",
58
- "./typescript/node18": "./typescript/tsconfig.node18.json",
59
- "./typescript/node20": "./typescript/tsconfig.node20.json",
60
- "./typescript/node22": "./typescript/tsconfig.node22.json",
61
- "./typescript/web": "./typescript/tsconfig.web.json"
62
- },
63
- "files": [
64
- "dist",
65
- "eslint",
66
- "prettier",
67
- "stylelint",
68
- "typescript",
69
- "next"
70
- ],
71
- "scripts": {
72
- "eslint-check": "eslint --max-warnings=0 .",
73
- "format": "eslint --fix . && prettier --write .",
74
- "prepare": "husky",
75
- "prepublishOnly": "tsc",
76
- "prettier-check": "prettier --check .",
77
- "semantic-release": "semantic-release",
78
- "test": "echo \"Error: no test specified\" && exit 1"
79
- },
80
- "lint-staged": {
81
- "*.{js,jsx,ts,tsx,css,yml,yaml}": "pnpm prettier --write"
82
- },
83
- "prettier": "./prettier/index.js",
84
- "stylelint": {
85
- "extends": "./stylelint/index.js"
86
- },
87
- "dependencies": {
88
- "@babel/core": "^7.26.9",
89
- "@babel/eslint-parser": "^7.26.8",
90
- "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
91
- "@eslint-react/eslint-plugin": "^1.26.2",
92
- "@next/eslint-plugin-next": "^15.1.7",
93
- "@stylistic/eslint-plugin-jsx": "^3.1.0",
94
- "eslint-config-prettier": "^10.0.1",
95
- "eslint-import-resolver-alias": "^1.1.2",
96
- "eslint-import-resolver-typescript": "^3.8.0",
97
- "eslint-plugin-import-x": "^4.6.1",
98
- "eslint-plugin-jsx-a11y": "^6.10.2",
99
- "eslint-plugin-playwright": "^2.2.0",
100
- "eslint-plugin-react": "^7.37.4",
101
- "eslint-plugin-react-hooks": "^5.1.0",
102
- "eslint-plugin-regexp": "^2.7.0",
103
- "eslint-plugin-simple-import-sort": "^12.1.1",
104
- "eslint-plugin-testing-library": "^7.1.1",
105
- "eslint-plugin-tsdoc": "^0.4.0",
106
- "eslint-plugin-unicorn": "^59.0.0",
107
- "postcss-html": "^1.8.0",
108
- "prettier-plugin-packagejson": "^2.5.8",
109
- "prettier-plugin-tailwindcss": "^0.6.11",
110
- "stylelint-config-clean-order": "^7.0.0",
111
- "stylelint-config-html": "^1.1.0",
112
- "stylelint-config-standard": "^37.0.0",
113
- "stylelint-config-tailwindcss": "^1.0.0",
114
- "stylelint-define-config": "^16.14.1",
115
- "typescript-eslint": "^8.24.0"
116
- },
117
- "devDependencies": {
118
- "@actions/core": "^1.11.1",
119
- "@actions/exec": "^1.1.1",
120
- "@actions/github": "^6.0.0",
121
- "@commitlint/cli": "^19.7.1",
122
- "@commitlint/config-conventional": "^19.7.1",
123
- "@eslint/eslintrc": "^3.2.0",
124
- "@eslint/js": "^9.20.0",
125
- "@octokit/types": "^13.8.0",
126
- "@semantic-release/git": "^10.0.1",
127
- "@types/eslint-config-prettier": "^6.11.3",
128
- "@types/node": "22",
129
- "@typescript-eslint/types": "^8.24.0",
130
- "eslint": "^9.20.1",
131
- "eslint-define-config": "^2.1.0",
132
- "globals": "^16.0.0",
133
- "husky": "^9.1.7",
134
- "lint-staged": "^15.4.3",
135
- "prettier": "^3.5.1",
136
- "semantic-release": "^24.2.3",
137
- "stylelint": "^16.14.1",
138
- "typescript": "^5.7.3"
139
- },
140
- "peerDependencies": {
141
- "eslint": ">=9",
142
- "prettier": ">=3.0.0 <4",
143
- "stylelint": ">=16.3.1 <17",
144
- "typescript": ">=5.0.0 <6"
145
- },
146
- "peerDependenciesMeta": {
147
- "eslint": {
148
- "optional": true
149
- },
150
- "prettier": {
151
- "optional": true
152
- },
153
- "stylelint": {
154
- "optional": true
155
- },
156
- "typescript": {
157
- "optional": true
158
- }
159
- },
160
- "packageManager": "pnpm@10.4.1",
161
- "engines": {
162
- "node": ">=20",
163
- "pnpm": ">=10"
164
- },
165
- "publishConfig": {
166
- "access": "public"
167
- },
168
- "pnpm": {
169
- "onlyBuiltDependencies": [
170
- "unrs-resolver"
171
- ]
172
- }
173
- }
2
+ "name": "@haltcase/style",
3
+ "version": "8.0.0-canary.6",
4
+ "description": "haltcase's web ecosystem style guide & configurations",
5
+ "keywords": [
6
+ "eslint",
7
+ "prettier",
8
+ "typescript",
9
+ "style",
10
+ "eslint-config"
11
+ ],
12
+ "homepage": "https://github.com/haltcase/style#readme",
13
+ "bugs": "https://github.com/haltcase/style/issues",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/haltcase/style.git"
17
+ },
18
+ "license": "MPL-2.0",
19
+ "author": "Bo Lingen <bo@haltcase.dev> (https://haltcase.dev)",
20
+ "type": "module",
21
+ "exports": {
22
+ "./eslint": {
23
+ "types": "./dist/types/eslint/index.d.ts",
24
+ "default": "./eslint/index.js"
25
+ },
26
+ "./eslint/rules/*": {
27
+ "types": "./dist/types/eslint/rules/*.d.ts",
28
+ "default": "./eslint/rules/*.js"
29
+ },
30
+ "./eslint/rules/typescript": {
31
+ "types": "./dist/types/eslint/rules/typescript/index.d.ts",
32
+ "default": "./eslint/rules/typescript/index.js"
33
+ },
34
+ "./prettier": {
35
+ "types": "./dist/types/prettier/index.d.ts",
36
+ "default": "./prettier/index.js"
37
+ },
38
+ "./stylelint": {
39
+ "types": "./dist/types/stylelint/index.d.ts",
40
+ "default": "./stylelint/index.js"
41
+ },
42
+ "./stylelint/modules": {
43
+ "types": "./dist/types/stylelint/modules.d.ts",
44
+ "default": "./stylelint/modules.js"
45
+ },
46
+ "./stylelint/standard": {
47
+ "types": "./dist/types/stylelint/standard.d.ts",
48
+ "default": "./stylelint/standard.js"
49
+ },
50
+ "./stylelint/tailwind": {
51
+ "types": "./dist/types/stylelint/tailwind.d.ts",
52
+ "default": "./stylelint/tailwind.js"
53
+ },
54
+ "./typescript/base": "./typescript/tsconfig.base.json",
55
+ "./typescript/bundler": "./typescript/tsconfig.bundler.json",
56
+ "./typescript/next": "./typescript/tsconfig.next.json",
57
+ "./typescript/node": "./typescript/tsconfig.node.json",
58
+ "./typescript/node18": "./typescript/tsconfig.node18.json",
59
+ "./typescript/node20": "./typescript/tsconfig.node20.json",
60
+ "./typescript/node22": "./typescript/tsconfig.node22.json",
61
+ "./typescript/web": "./typescript/tsconfig.web.json"
62
+ },
63
+ "files": [
64
+ "dist",
65
+ "eslint",
66
+ "prettier",
67
+ "stylelint",
68
+ "typescript",
69
+ "next"
70
+ ],
71
+ "lint-staged": {
72
+ "*.{js,jsx,ts,tsx,css,yml,yaml}": "pnpm prettier --write"
73
+ },
74
+ "prettier": "./prettier/index.js",
75
+ "stylelint": {
76
+ "extends": "./stylelint/index.js"
77
+ },
78
+ "dependencies": {
79
+ "@babel/core": "^7.26.9",
80
+ "@babel/eslint-parser": "^7.26.8",
81
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
82
+ "@eslint-react/eslint-plugin": "^1.26.2",
83
+ "@next/eslint-plugin-next": "^15.1.7",
84
+ "@stylistic/eslint-plugin-jsx": "^4.2.0",
85
+ "eslint-config-prettier": "^10.0.1",
86
+ "eslint-import-resolver-alias": "^1.1.2",
87
+ "eslint-import-resolver-typescript": "^4.3.4",
88
+ "eslint-plugin-import-x": "^4.6.1",
89
+ "eslint-plugin-jsx-a11y": "^6.10.2",
90
+ "eslint-plugin-playwright": "^2.2.0",
91
+ "eslint-plugin-react": "^7.37.4",
92
+ "eslint-plugin-react-hooks": "^5.1.0",
93
+ "eslint-plugin-regexp": "^2.7.0",
94
+ "eslint-plugin-simple-import-sort": "^12.1.1",
95
+ "eslint-plugin-testing-library": "^7.1.1",
96
+ "eslint-plugin-tsdoc": "^0.4.0",
97
+ "eslint-plugin-unicorn": "^60.0.0",
98
+ "postcss-html": "^1.8.0",
99
+ "prettier-plugin-packagejson": "^2.5.8",
100
+ "prettier-plugin-tailwindcss": "^0.6.11",
101
+ "stylelint-config-clean-order": "^7.0.0",
102
+ "stylelint-config-html": "^1.1.0",
103
+ "stylelint-config-standard": "^38.0.0",
104
+ "stylelint-config-tailwindcss": "^1.0.0",
105
+ "stylelint-define-config": "^16.14.1",
106
+ "typescript-eslint": "^8.40.0"
107
+ },
108
+ "devDependencies": {
109
+ "@actions/core": "^1.11.1",
110
+ "@actions/exec": "^1.1.1",
111
+ "@actions/github": "^6.0.0",
112
+ "@commitlint/cli": "^19.7.1",
113
+ "@commitlint/config-conventional": "^19.7.1",
114
+ "@eslint/eslintrc": "^3.2.0",
115
+ "@eslint/js": "^9.20.0",
116
+ "@octokit/types": "^14.0.0",
117
+ "@semantic-release/git": "^10.0.1",
118
+ "@types/eslint-config-prettier": "^6.11.3",
119
+ "@types/node": "22",
120
+ "@typescript-eslint/types": "^8.40.0",
121
+ "eslint": "^9.20.1",
122
+ "eslint-define-config": "^2.1.0",
123
+ "globals": "^16.0.0",
124
+ "husky": "^9.1.7",
125
+ "lint-staged": "^16.1.0",
126
+ "prettier": "^3.5.1",
127
+ "semantic-release": "^24.2.3",
128
+ "stylelint": "^16.14.1",
129
+ "typescript": "^5.7.3"
130
+ },
131
+ "peerDependencies": {
132
+ "eslint": ">=9",
133
+ "prettier": ">=3.0.0 <4",
134
+ "stylelint": ">=16.3.1 <17",
135
+ "typescript": ">=5.0.0 <6"
136
+ },
137
+ "peerDependenciesMeta": {
138
+ "eslint": {
139
+ "optional": true
140
+ },
141
+ "prettier": {
142
+ "optional": true
143
+ },
144
+ "stylelint": {
145
+ "optional": true
146
+ },
147
+ "typescript": {
148
+ "optional": true
149
+ }
150
+ },
151
+ "engines": {
152
+ "node": ">=20",
153
+ "pnpm": ">=10"
154
+ },
155
+ "publishConfig": {
156
+ "access": "public"
157
+ },
158
+ "scripts": {
159
+ "eslint-check": "eslint --max-warnings=0 .",
160
+ "format": "eslint --fix . && prettier --write .",
161
+ "prettier-check": "prettier --check .",
162
+ "semantic-release": "semantic-release",
163
+ "test": "echo \"Error: no test specified\" && exit 1"
164
+ }
165
+ }
package/readme.md CHANGED
@@ -186,6 +186,47 @@ export default [
186
186
  ];
187
187
  ```
188
188
 
189
+ You can also enable TypeScript ESLint's
190
+ [`projectService`](https://typescript-eslint.io/packages/parser#projectservice):
191
+
192
+ ```js
193
+ import { getEslintConfig } from "@haltcase/style/eslint";
194
+
195
+ export default [
196
+ ...getEslintConfig({
197
+ typescriptProject: {
198
+ projectService: true
199
+ }
200
+ })
201
+ ];
202
+ ```
203
+
204
+ Because `eslint-import-resolver-typescript` [does not support
205
+ `projectService`](https://github.com/import-js/eslint-import-resolver-typescript/issues/282),
206
+ you should either:
207
+
208
+ 1. Have a single `tsconfig.json` file in your root directory, including [project
209
+ references](https://www.typescriptlang.org/docs/handbook/project-references.html)
210
+ if necessary.
211
+
212
+ 2. Explicitly pass your `tsconfig.json` paths:
213
+
214
+ ```js
215
+ import { getEslintConfig } from "@haltcase/style/eslint";
216
+
217
+ export default [
218
+ ...getEslintConfig({
219
+ typescriptProject: {
220
+ projectService: true,
221
+ tsconfigPaths: [
222
+ "./packages/**/tsconfig.json",
223
+ "./separate-package/tsconfig.json"
224
+ ]
225
+ }
226
+ })
227
+ ];
228
+ ```
229
+
189
230
  If you need to further customize the TypeScript behavior, use a separate config
190
231
  with your own options, for example:
191
232