@cluerise/tools 3.0.1 → 4.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.
package/README.md CHANGED
@@ -6,8 +6,9 @@ _Tools for maintaining TypeScript projects_
6
6
 
7
7
  ### Init
8
8
 
9
- ```
10
- npx @cluerise/tools init [all|name]
9
+ ```sh
10
+ pnpm add -DE @cluerise/tools
11
+ pnpm exec @cluerise/tools init [all|name]
11
12
  ```
12
13
 
13
14
  Before you run the `init` command, make sure your `package.json` contains
@@ -17,36 +18,36 @@ Before you run the `init` command, make sure your `package.json` contains
17
18
 
18
19
  ### Lint
19
20
 
20
- ```
21
- cluerise-tools lint [all|code|staged|commit]
21
+ ```sh
22
+ cluerise-tools lint [all|fix|staged|commit]
22
23
  ```
23
24
 
24
25
  ### Release
25
26
 
26
- ```
27
+ ```sh
27
28
  cluerise-tools release [create|extract-changelog]
28
29
  ```
29
30
 
30
31
  ### Update Node.js versions
31
32
 
32
- ```
33
+ ```sh
33
34
  cluerise-tools update-node-versions
34
35
  ```
35
36
 
36
37
  ### Create Commit Message
37
38
 
38
- ```
39
+ ```sh
39
40
  cluerise-tools create-commit-message
40
41
  ```
41
42
 
42
43
  ### Format Commit Message
43
44
 
44
- ```
45
+ ```sh
45
46
  cluerise-tools format-commit-message
46
47
  ```
47
48
 
48
49
  ### Check Heroku Node.js Version
49
50
 
50
- ```
51
+ ```sh
51
52
  cluerise-tools check-heroku-node-version
52
53
  ```
@@ -1 +1 @@
1
- v22.1.0
1
+ v24.1.0
@@ -23,15 +23,22 @@ hooks/*
23
23
  !hooks/*.ts
24
24
 
25
25
  # Lock files
26
+ pnpm-lock.yaml
26
27
  package-lock.json
27
28
  yarn.lock
28
29
 
29
30
  # Misc
30
31
  etc/
32
+ .DS_Store
31
33
 
32
34
  # Sample of .env file
33
35
  .env.example
34
36
  .env.sample
37
+ .envrc.example
38
+ .envrc.sample
39
+
40
+ # Stryker
41
+ .stryker-tmp/
35
42
 
36
43
  # Tests coverage
37
44
  coverage/
@@ -1,7 +1,7 @@
1
1
  import { RuleConfigSeverity, UserConfig } from '@commitlint/types';
2
2
 
3
3
  const commitlintConfig: UserConfig = {
4
- parserPreset: 'conventional-changelog-conventionalcommits',
4
+ extends: ['@commitlint/config-conventional'],
5
5
  rules: {
6
6
  'body-full-stop': [RuleConfigSeverity.Error, 'always', '.'],
7
7
  'body-leading-blank': [RuleConfigSeverity.Error, 'always'],
@@ -0,0 +1,8 @@
1
+ import eslintMarkdown from '@eslint/markdown';
2
+
3
+ export default [
4
+ {
5
+ ignores: ['**/*.(j|t)sx?']
6
+ },
7
+ ...eslintMarkdown.configs.recommended
8
+ ];
@@ -0,0 +1,329 @@
1
+ import eslintJs from '@eslint/js';
2
+ import eslintJson from '@eslint/json';
3
+ import eslintMarkdown from '@eslint/markdown';
4
+ import eslintPluginHtml from '@html-eslint/eslint-plugin';
5
+ import { defineConfig } from 'eslint/config';
6
+ import eslintPluginImport from 'eslint-plugin-import';
7
+ import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
8
+ import eslintPluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
9
+ import eslintPluginUnicorn from 'eslint-plugin-unicorn';
10
+ import eslintPluginYml from 'eslint-plugin-yml';
11
+ import globals from 'globals';
12
+ import typescriptEslint from 'typescript-eslint';
13
+
14
+ export default defineConfig([
15
+ // JavaScript
16
+ {
17
+ ...eslintJs.configs.recommended,
18
+ name: 'cluerise: eslint/js'
19
+ },
20
+ {
21
+ name: 'cluerise: eslint/js/rules',
22
+ rules: {
23
+ 'no-irregular-whitespace': 'off',
24
+ 'no-restricted-globals': ['error', 'JSON'],
25
+ 'no-undef-init': 'error',
26
+ 'no-unused-vars': 'off',
27
+ 'object-shorthand': 'error',
28
+ 'sort-imports': 'off'
29
+ }
30
+ },
31
+ // TypeScript
32
+ ...typescriptEslint.configs.recommendedTypeChecked.map((config) => ({
33
+ ...config,
34
+ name: `cluerise: ${config.name ?? 'typescript-eslint'}`
35
+ })),
36
+ {
37
+ name: 'cluerise: typescript-eslint/language-options',
38
+ languageOptions: {
39
+ globals: {
40
+ ...globals.browser,
41
+ ...globals.node
42
+ },
43
+ parserOptions: {
44
+ projectService: {
45
+ allowDefaultProject: ['*.md/*']
46
+ },
47
+ tsconfigRootDir: import.meta.dirname
48
+ }
49
+ }
50
+ },
51
+ {
52
+ name: 'cluerise: typescript-eslint/disable-type-checked',
53
+ files: ['**/*.js', '**/*.json', '**/*.yaml'],
54
+ extends: [typescriptEslint.configs.disableTypeChecked]
55
+ },
56
+ {
57
+ name: 'cluerise: typescript-eslint/rules',
58
+ rules: {
59
+ '@typescript-eslint/ban-ts-comment': 'off',
60
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
61
+ '@typescript-eslint/no-import-type-side-effects': 'error',
62
+ '@typescript-eslint/no-unused-vars': [
63
+ 'error',
64
+ {
65
+ args: 'all',
66
+ argsIgnorePattern: '^_',
67
+ caughtErrors: 'all',
68
+ caughtErrorsIgnorePattern: '^_',
69
+ destructuredArrayIgnorePattern: '^_',
70
+ ignoreRestSiblings: true,
71
+ varsIgnorePattern: '^_'
72
+ }
73
+ ]
74
+ }
75
+ },
76
+ {
77
+ name: 'cluerise: typescript-eslint/rules',
78
+ files: ['**/*.tsx?'],
79
+ rules: {
80
+ '@typescript-eslint/consistent-type-imports': ['error', { fixStyle: 'inline-type-imports' }]
81
+ }
82
+ },
83
+ // JSON
84
+ {
85
+ name: 'cluerise: eslint/json',
86
+ files: ['**/*.json'],
87
+ plugins: { json: eslintJson },
88
+ language: 'json/json',
89
+ extends: ['json/recommended']
90
+ },
91
+ {
92
+ name: 'cluerise: eslint/jsonc',
93
+ files: ['**/*.jsonc'],
94
+ plugins: { json: eslintJson },
95
+ language: 'json/jsonc',
96
+ extends: ['json/recommended']
97
+ },
98
+ // Markdown
99
+ {
100
+ name: 'cluerise: eslint/markdown',
101
+ files: ['**/*.md'],
102
+ plugins: { markdown: eslintMarkdown },
103
+ processor: 'markdown/markdown',
104
+ extends: ['markdown/recommended']
105
+ },
106
+ // YAML
107
+ ...eslintPluginYml.configs['flat/recommended'].map((config) => ({
108
+ ...config,
109
+ name: `cluerise: ${config.name ?? 'eslint/yaml'}`
110
+ })),
111
+ {
112
+ name: 'cluerise: eslint/yaml/rules',
113
+ rules: {
114
+ 'yml/no-empty-mapping-value': 'off',
115
+ 'yml/quotes': ['error', { prefer: 'single' }]
116
+ }
117
+ },
118
+ // Import
119
+ {
120
+ name: 'cluerise: eslint/import/js',
121
+ files: ['**/*.js'],
122
+ extends: [eslintPluginImport.flatConfigs.recommended],
123
+ rules: {
124
+ 'import/first': 'error',
125
+ 'import/namespace': 'off',
126
+ 'import/newline-after-import': 'error',
127
+ 'import/no-amd': 'error',
128
+ 'import/no-commonjs': 'error',
129
+ 'import/no-default-export': 'error',
130
+ 'import/no-duplicates': 'error',
131
+ 'import/no-mutable-exports': 'error',
132
+ 'import/no-unassigned-import': ['error', { allow: ['reset-css'] }],
133
+ 'import/order': 'off'
134
+ }
135
+ },
136
+ {
137
+ name: 'cluerise: eslint/import/ts',
138
+ files: ['**/*.tsx?'],
139
+ extends: [eslintPluginImport.flatConfigs.recommended, eslintPluginImport.flatConfigs.typescript],
140
+ rules: {
141
+ 'import/first': 'error',
142
+ 'import/namespace': 'off',
143
+ 'import/newline-after-import': 'error',
144
+ 'import/no-amd': 'error',
145
+ 'import/no-commonjs': 'error',
146
+ 'import/no-default-export': 'error',
147
+ 'import/no-duplicates': 'error',
148
+ 'import/no-mutable-exports': 'error',
149
+ 'import/no-unassigned-import': ['error', { allow: ['reset-css'] }],
150
+ 'import/order': 'off'
151
+ }
152
+ },
153
+ {
154
+ name: 'cluerise: eslint/import/rules/config.js',
155
+ files: ['*.config.js'],
156
+ rules: {
157
+ '@typescript-eslint/no-require-imports': 'off',
158
+ 'import/no-commonjs': 'off'
159
+ }
160
+ },
161
+ {
162
+ name: 'cluerise: eslint/import/rules/config.js,ts',
163
+ files: ['*.config.js', '*.config.ts'],
164
+ rules: {
165
+ 'import/no-default-export': 'off'
166
+ }
167
+ },
168
+ {
169
+ name: 'cluerise: eslint/import/rules/routes',
170
+ files: ['*-route.tsx'],
171
+ rules: {
172
+ 'import/no-default-export': 'off'
173
+ }
174
+ },
175
+ {
176
+ name: 'cluerise: settings/eslint/import',
177
+ settings: {
178
+ 'import/resolver': {
179
+ typescript: {}
180
+ }
181
+ }
182
+ },
183
+ // Simple Import Sort
184
+ {
185
+ name: 'cluerise: eslint/simple-import-sort',
186
+ plugins: {
187
+ 'simple-import-sort': eslintPluginSimpleImportSort
188
+ },
189
+ rules: {
190
+ 'simple-import-sort/exports': 'error',
191
+ 'simple-import-sort/imports': 'error'
192
+ }
193
+ },
194
+ // Unicorn
195
+ {
196
+ ...eslintPluginUnicorn.configs.recommended,
197
+ name: 'cluerise: eslint/unicorn'
198
+ },
199
+ {
200
+ name: 'cluerise: eslint/unicorn/rules',
201
+ rules: {
202
+ 'unicorn/expiring-todo-comments': 'off',
203
+ 'unicorn/no-null': 'off',
204
+ 'unicorn/no-static-only-class': 'off',
205
+ 'unicorn/prevent-abbreviations': [
206
+ 'error',
207
+ {
208
+ replacements: {
209
+ arg: false,
210
+ args: false,
211
+ dist: false,
212
+ params: false,
213
+ utils: false
214
+ }
215
+ }
216
+ ],
217
+ 'unicorn/switch-case-braces': ['error', 'avoid'],
218
+ 'unicorn/filename-case': ['error', { case: 'kebabCase', ignore: [String.raw`\.md$`] }]
219
+ }
220
+ },
221
+ // HTML
222
+ {
223
+ ...eslintPluginHtml.configs['flat/recommended'],
224
+ name: 'cluerise: html-eslint',
225
+ files: ['**/*.html']
226
+ },
227
+ {
228
+ name: 'cluerise: html-eslint/rules',
229
+ files: ['**/*.html'],
230
+ rules: {
231
+ '@html-eslint/indent': ['error', 2],
232
+ '@html-eslint/no-extra-spacing-attrs': ['error', { enforceBeforeSelfClose: true }],
233
+ '@html-eslint/require-closing-tags': ['error', { selfClosing: 'always' }],
234
+ '@html-eslint/require-title': 'off'
235
+ }
236
+ },
237
+ // Ignore
238
+ {
239
+ name: 'cluerise: ignore',
240
+ ignores: [
241
+ // All hidden files and directories
242
+ '.*',
243
+
244
+ // Enable hidden files with extensions
245
+ '!.*.*',
246
+
247
+ // Enable all hidden directories
248
+ '!.*/',
249
+
250
+ // Archives
251
+ '*.zip',
252
+ '*.gz',
253
+ '*.tgz',
254
+
255
+ // Build
256
+ 'build/',
257
+ 'dist/',
258
+
259
+ // CSS
260
+ '*.css',
261
+
262
+ // Dependencies
263
+ 'node_modules/',
264
+
265
+ // Fonts
266
+ '*.ttf',
267
+ '*.woff2',
268
+
269
+ // Generated files
270
+ '__generated__/',
271
+ 'patches/',
272
+
273
+ // Git
274
+ '.git/',
275
+
276
+ // Git hooks
277
+ 'hooks/*',
278
+ '!hooks/*.js',
279
+ '!hooks/*.ts',
280
+
281
+ // I18n
282
+ '*.po',
283
+
284
+ // Images
285
+ '*.ico',
286
+ '*.png',
287
+ '*.svg',
288
+ '*.webp',
289
+
290
+ // Lock files
291
+ 'pnpm-lock.yaml',
292
+ 'package-lock.json',
293
+ 'yarn.lock',
294
+
295
+ // Lua scripts
296
+ '*.lua',
297
+
298
+ // Misc
299
+ 'etc/',
300
+ '.DS_Store',
301
+
302
+ // Sample of .env and .envrc files
303
+ '.env.example',
304
+ '.env.sample',
305
+ '.envrc.example',
306
+ '.envrc.sample',
307
+
308
+ // Shell scripts
309
+ '*.sh',
310
+
311
+ // Stryker
312
+ '.stryker-tmp/',
313
+
314
+ // Tests coverage
315
+ 'coverage/',
316
+
317
+ // Texts
318
+ '*.txt',
319
+
320
+ // XML
321
+ '*.xml'
322
+ ]
323
+ },
324
+ // Prettier
325
+ {
326
+ ...eslintPluginPrettier,
327
+ name: 'cluerise: eslint/prettier'
328
+ }
329
+ ]);
@@ -1 +1 @@
1
- npm run __git-hook:commit-msg --if-present "$@"
1
+ pnpm run --if-present __git-hook:commit-msg "$@"
@@ -1 +1 @@
1
- npm run __git-hook:post-commit --if-present "$@"
1
+ pnpm run --if-present __git-hook:post-commit "$@"
@@ -1 +1 @@
1
- npm run __git-hook:pre-commit --if-present "$@"
1
+ pnpm run --if-present __git-hook:pre-commit "$@"
@@ -1 +1 @@
1
- npm run __git-hook:prepare-commit-msg --if-present "$@"
1
+ pnpm run --if-present __git-hook:prepare-commit-msg "$@"
@@ -1,10 +1,9 @@
1
- import FileSystem from 'fs';
2
- import Path from 'path';
1
+ import FileSystem from 'node:fs';
2
+ import Path from 'node:path';
3
3
 
4
4
  const tsconfigPath = '.lint-staged-temp-tsconfig.json';
5
5
 
6
- const toRelative = (filename) => Path.relative('.', filename);
7
- const mapToRelative = (filenames) => filenames.map(toRelative);
6
+ const mapToRelative = (filenames) => filenames.map((filename) => Path.relative('.', filename));
8
7
 
9
8
  export default {
10
9
  '**': (filenames) => {
@@ -23,6 +22,7 @@ export default {
23
22
  files: relativeFilenames
24
23
  };
25
24
 
25
+ // eslint-disable-next-line no-restricted-globals
26
26
  FileSystem.writeFileSync(tsconfigPath, JSON.stringify(tsconfig));
27
27
  }
28
28
 
@@ -0,0 +1 @@
1
+ engineStrict: true
@@ -79,7 +79,7 @@ export const createReleaseConfig = ({
79
79
  {{#if noteGroups}}
80
80
  {{#each noteGroups}}
81
81
 
82
- ### ⚠ {{title}} !!
82
+ ### ⚠ {{title}}!
83
83
 
84
84
  {{#each notes}}
85
85
  * {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}
@@ -8,20 +8,15 @@
8
8
  "jsx": "preserve",
9
9
  "lib": ["dom", "esnext"],
10
10
  "module": "esnext",
11
- "moduleResolution": "node",
11
+ "moduleResolution": "bundler",
12
12
  "noEmit": true,
13
13
  "noUncheckedIndexedAccess": true,
14
14
  "noUnusedLocals": true,
15
15
  "noUnusedParameters": true,
16
- "baseUrl": "./",
17
- "paths": {
18
- ":/*": ["./src/*/index"]
19
- },
20
16
  "resolveJsonModule": true,
21
17
  "skipLibCheck": true,
22
18
  "strict": true,
23
- "target": "esnext",
24
- "types": ["node", "vite/client"]
19
+ "target": "esnext"
25
20
  },
26
21
  "exclude": ["node_modules"]
27
22
  }