@haltcase/style 8.0.0-canary.3 → 8.0.0-canary.7
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.
- package/dist/types/eslint/configs/internal/base.d.ts +5 -0
- package/eslint/configs/internal/base.js +1 -0
- package/eslint/configs/internal/unicorn.js +24 -0
- package/eslint/configs/next.js +6 -2
- package/eslint/configs/typescript.js +4 -1
- package/eslint/rules/typescript/naming-convention.js +1 -1
- package/package.json +7 -7
- package/readme.md +3 -1
- package/typescript/tsconfig.node-ts.json +10 -0
- package/typescript/tsconfig.node.json +1 -1
- package/typescript/tsconfig.node20.json +2 -1
- package/typescript/tsconfig.node22.json +3 -2
- package/typescript/tsconfig.node24.json +17 -0
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* @property {boolean} [nextjs] Whether to include Next.js rules (implies `react`).
|
|
16
16
|
* @property {boolean} [node] Whether to include Node.js rules.
|
|
17
17
|
* @property {boolean} [react] Whether to include React rules.
|
|
18
|
+
* @property {string[]} [typescriptComponentPaths] Additional paths to consider as TypeScript component files.
|
|
18
19
|
* @property {TypeScriptProjectOptions} [typescriptProject] Custom TypeScript project options for
|
|
19
20
|
* the `typescript-eslint` parser and `eslint-import-resolver-typescript`.
|
|
20
21
|
*/
|
|
@@ -61,6 +62,10 @@ export type HaltcaseStyleOptions = {
|
|
|
61
62
|
* Whether to include React rules.
|
|
62
63
|
*/
|
|
63
64
|
react?: boolean | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Additional paths to consider as TypeScript component files.
|
|
67
|
+
*/
|
|
68
|
+
typescriptComponentPaths?: string[] | undefined;
|
|
64
69
|
/**
|
|
65
70
|
* Custom TypeScript project options for
|
|
66
71
|
* the `typescript-eslint` parser and `eslint-import-resolver-typescript`.
|
|
@@ -49,6 +49,7 @@ import { prepareTypeScriptProjectConfig } from "./utils/typescript.js";
|
|
|
49
49
|
* @property {boolean} [nextjs] Whether to include Next.js rules (implies `react`).
|
|
50
50
|
* @property {boolean} [node] Whether to include Node.js rules.
|
|
51
51
|
* @property {boolean} [react] Whether to include React rules.
|
|
52
|
+
* @property {string[]} [typescriptComponentPaths] Additional paths to consider as TypeScript component files.
|
|
52
53
|
* @property {TypeScriptProjectOptions} [typescriptProject] Custom TypeScript project options for
|
|
53
54
|
* the `typescript-eslint` parser and `eslint-import-resolver-typescript`.
|
|
54
55
|
*/
|
|
@@ -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
|
*
|
package/eslint/configs/next.js
CHANGED
|
@@ -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
|
-
...
|
|
39
|
-
...
|
|
42
|
+
...nextJsConfigs.recommended.rules,
|
|
43
|
+
...nextJsConfigs["core-web-vitals"].rules
|
|
40
44
|
}
|
|
41
45
|
},
|
|
42
46
|
{
|
|
@@ -105,7 +105,10 @@ export const getEslintTypescriptConfigInternal = (options = {}) => {
|
|
|
105
105
|
// to create a customized instance of a UI component
|
|
106
106
|
name: "@haltcase/internal/TypeScript component files",
|
|
107
107
|
|
|
108
|
-
files: [
|
|
108
|
+
files: [
|
|
109
|
+
"**/components/**/*.ts",
|
|
110
|
+
...(options.typescriptComponentPaths ?? [])
|
|
111
|
+
],
|
|
109
112
|
languageOptions,
|
|
110
113
|
|
|
111
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haltcase/style",
|
|
3
|
-
"version": "8.0.0-canary.
|
|
3
|
+
"version": "8.0.0-canary.7",
|
|
4
4
|
"description": "haltcase's web ecosystem style guide & configurations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -103,16 +103,16 @@
|
|
|
103
103
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
104
104
|
"eslint-plugin-testing-library": "^7.1.1",
|
|
105
105
|
"eslint-plugin-tsdoc": "^0.4.0",
|
|
106
|
-
"eslint-plugin-unicorn": "^
|
|
106
|
+
"eslint-plugin-unicorn": "^60.0.0",
|
|
107
107
|
"postcss-html": "^1.8.0",
|
|
108
108
|
"prettier-plugin-packagejson": "^2.5.8",
|
|
109
109
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
|
110
110
|
"stylelint-config-clean-order": "^7.0.0",
|
|
111
111
|
"stylelint-config-html": "^1.1.0",
|
|
112
|
-
"stylelint-config-standard": "^
|
|
112
|
+
"stylelint-config-standard": "^38.0.0",
|
|
113
113
|
"stylelint-config-tailwindcss": "^1.0.0",
|
|
114
114
|
"stylelint-define-config": "^16.14.1",
|
|
115
|
-
"typescript-eslint": "^8.
|
|
115
|
+
"typescript-eslint": "^8.40.0"
|
|
116
116
|
},
|
|
117
117
|
"devDependencies": {
|
|
118
118
|
"@actions/core": "^1.11.1",
|
|
@@ -122,16 +122,16 @@
|
|
|
122
122
|
"@commitlint/config-conventional": "^19.7.1",
|
|
123
123
|
"@eslint/eslintrc": "^3.2.0",
|
|
124
124
|
"@eslint/js": "^9.20.0",
|
|
125
|
-
"@octokit/types": "^
|
|
125
|
+
"@octokit/types": "^14.0.0",
|
|
126
126
|
"@semantic-release/git": "^10.0.1",
|
|
127
127
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
128
128
|
"@types/node": "22",
|
|
129
|
-
"@typescript-eslint/types": "^8.
|
|
129
|
+
"@typescript-eslint/types": "^8.40.0",
|
|
130
130
|
"eslint": "^9.20.1",
|
|
131
131
|
"eslint-define-config": "^2.1.0",
|
|
132
132
|
"globals": "^16.0.0",
|
|
133
133
|
"husky": "^9.1.7",
|
|
134
|
-
"lint-staged": "^
|
|
134
|
+
"lint-staged": "^16.1.0",
|
|
135
135
|
"prettier": "^3.5.1",
|
|
136
136
|
"semantic-release": "^24.2.3",
|
|
137
137
|
"stylelint": "^16.14.1",
|
package/readme.md
CHANGED
|
@@ -313,10 +313,12 @@ Several Typescript configs are available to cover various scenarios:
|
|
|
313
313
|
| `@haltcase/style/typescript/base` | Baseline config, intended to be extended from. |
|
|
314
314
|
| `@haltcase/style/typescript/bundler` | For use in bundled projects, most commonly [Vite](https://vitejs.dev/) + [React](https://react.dev). |
|
|
315
315
|
| `@haltcase/style/typescript/next` | For use in [Next.js](https://nextjs.org/) projects. |
|
|
316
|
-
| `@haltcase/style/typescript/node` | Default Node config, currently targeting Node
|
|
316
|
+
| `@haltcase/style/typescript/node` | Default Node config, currently targeting Node 24. |
|
|
317
|
+
| `@haltcase/style/typescript/node-ts` | Addon for other Node configs for use with Node's built-in TypeScript support. |
|
|
317
318
|
| `@haltcase/style/typescript/node18` | For projects targeting Node 18. |
|
|
318
319
|
| `@haltcase/style/typescript/node20` | For projects targeting Node 20. |
|
|
319
320
|
| `@haltcase/style/typescript/node22` | For projects targeting Node 22. |
|
|
321
|
+
| `@haltcase/style/typescript/node24` | For projects targeting Node 24. |
|
|
320
322
|
| `@haltcase/style/typescript/web` | For use in web projects. |
|
|
321
323
|
|
|
322
324
|
Typically, you'll only need to extend from one of these:
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
// https://devblogs.microsoft.com/typescript/announcing-typescript-5-7/#path-rewriting-for-relative-paths
|
|
5
|
+
"rewriteRelativeImportExtensions": true,
|
|
6
|
+
// https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option
|
|
7
|
+
"erasableSyntaxOnly": true,
|
|
8
|
+
"verbatimModuleSyntax": true
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
3
|
"extends": "./tsconfig.base.json",
|
|
4
4
|
"compilerOptions": {
|
|
5
|
-
"lib": ["
|
|
6
|
-
"module": "
|
|
5
|
+
"lib": ["es2024", "ESNext.Array", "ESNext.Collection", "ESNext.Iterator"],
|
|
6
|
+
// Use `"module": "node20"` when TypeScript 5.9+ is widely used
|
|
7
|
+
"module": "nodenext",
|
|
7
8
|
"target": "es2022",
|
|
8
9
|
"moduleResolution": "node16"
|
|
9
10
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "./tsconfig.base.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"lib": [
|
|
6
|
+
"es2024",
|
|
7
|
+
"ESNext.Array",
|
|
8
|
+
"ESNext.Collection",
|
|
9
|
+
"ESNext.Iterator",
|
|
10
|
+
"ESNext.Promise"
|
|
11
|
+
],
|
|
12
|
+
// Use `"module": "node20"` when TypeScript 5.9+ is widely used
|
|
13
|
+
"module": "nodenext",
|
|
14
|
+
"target": "es2024",
|
|
15
|
+
"moduleResolution": "node16"
|
|
16
|
+
}
|
|
17
|
+
}
|