Skip to content

Commit f8c462c

Browse files
committed
Make reselect-codemods a Yarn workspace
1 parent 276ea31 commit f8c462c

29 files changed

+2694
-4293
lines changed

.github/workflows/test-reselect-codemods.yml

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
uses: actions/setup-node@v4
2626
with:
2727
node-version: ${{ matrix.node-version }}
28-
cache-dependency-path: ./codemods
2928
cache: 'yarn'
3029

3130
- name: Check folder contents

codemods/.gitignore

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Dependencies
2-
node_modules
2+
node_modules/
33

44
# Production
5-
build
5+
build/
66

77
# Generated files
8-
.docusaurus
8+
.docusaurus/
99
.cache-loader
1010

1111
# Misc
@@ -18,7 +18,7 @@ build
1818
npm-debug.log*
1919
yarn-debug.log*
2020
yarn-error.log*
21-
.cache
21+
.cache/
2222
.yarnrc
2323
.yarn/*
2424
!.yarn/patches
@@ -31,9 +31,15 @@ yarn-error.log*
3131

3232
tsconfig.vitest-temp.json
3333
.eslintcache
34+
*.tsbuildinfo
3435

35-
.yalc
36+
.yalc/
3637
.yalc.lock
37-
.vscode
38-
dist
39-
temp
38+
.vscode/
39+
coverage/
40+
build/
41+
lib/
42+
dist/
43+
temp/
44+
.tmp/
45+
.temp/

codemods/bin/cli.mjs

-39
This file was deleted.

codemods/eslint.config.mts

+121-15
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
import js from '@eslint/js'
2-
import prettierConfig from 'eslint-config-prettier'
2+
import vitestPlugin from '@vitest/eslint-plugin'
3+
import prettierConfig from 'eslint-config-prettier/flat'
4+
import type { ConfigArray } from 'typescript-eslint'
35
import { config, configs, parser } from 'typescript-eslint'
46

5-
const ESLintConfig = config(
6-
{ name: 'ignores', ignores: ['**/dist/', '**/__testfixtures__/'] },
7-
{ name: 'javascript', ...js.configs.recommended },
7+
const eslintConfig: ConfigArray = config(
8+
{
9+
name: 'global-ignores',
10+
ignores: [
11+
'**/dist/',
12+
'**/.yalc/',
13+
'**/build/',
14+
'**/lib/',
15+
'**/temp/',
16+
'**/.temp/',
17+
'**/.tmp/',
18+
'**/.yarn/',
19+
'**/coverage/',
20+
'**/__testfixtures__/',
21+
],
22+
},
23+
{ name: `${js.meta.name}/recommended`, ...js.configs.recommended },
824
...configs.recommended,
925
...configs.stylistic,
10-
{ name: 'prettier-config', ...prettierConfig },
26+
{ name: 'vitest/recommended', ...vitestPlugin.configs.recommended },
1127
{
1228
name: 'main',
1329
languageOptions: {
@@ -16,27 +32,58 @@ const ESLintConfig = config(
1632
projectService: {
1733
defaultProject: './tsconfig.json',
1834
},
35+
tsconfigRootDir: import.meta.dirname,
1936
ecmaVersion: 'latest',
2037
},
2138
},
2239
rules: {
23-
'no-undef': [0],
2440
'@typescript-eslint/consistent-type-imports': [
2541
2,
26-
{ fixStyle: 'separate-type-imports', disallowTypeAnnotations: false },
42+
{
43+
prefer: 'type-imports',
44+
fixStyle: 'separate-type-imports',
45+
disallowTypeAnnotations: true,
46+
},
47+
],
48+
'@typescript-eslint/consistent-type-exports': [
49+
2,
50+
{ fixMixedExportsWithInlineTypeSpecifier: false },
51+
],
52+
'@typescript-eslint/no-explicit-any': [
53+
2,
54+
{ fixToUnknown: false, ignoreRestArgs: false },
2755
],
28-
'@typescript-eslint/consistent-type-exports': [2],
29-
'@typescript-eslint/no-unused-vars': [0],
30-
'@typescript-eslint/no-explicit-any': [0],
3156
'@typescript-eslint/no-empty-object-type': [
3257
2,
33-
{ allowInterfaces: 'with-single-extends' },
58+
{ allowInterfaces: 'never', allowObjectTypes: 'never' },
59+
],
60+
'@typescript-eslint/no-restricted-types': [
61+
2,
62+
{
63+
types: {
64+
'{}': {
65+
message: `
66+
- If you want to represent an empty object, use \`type EmptyObject = Record<string, never>\`.
67+
- If you want to represent an object literal, use either \`type AnyObject = Record<string, any>\` or \`object\`.
68+
- If you want to represent any non-nullish value, use \`type AnyNonNullishValue = NonNullable<unknown>\`.`,
69+
suggest: [
70+
'AnyNonNullishValue',
71+
'EmptyObject',
72+
'AnyObject',
73+
'object',
74+
'Record<string, never>',
75+
'Record<string, any>',
76+
'NonNullable<unknown>',
77+
],
78+
},
79+
},
80+
},
3481
],
3582
'@typescript-eslint/no-namespace': [
3683
2,
37-
{ allowDeclarations: true, allowDefinitionFiles: true },
84+
{ allowDeclarations: false, allowDefinitionFiles: true },
3885
],
39-
'@typescript-eslint/ban-ts-comment': [0],
86+
'@typescript-eslint/consistent-type-definitions': [2, 'type'],
4087
'sort-imports': [
4188
2,
4289
{
@@ -47,17 +94,76 @@ const ESLintConfig = config(
4794
allowSeparatedGroups: true,
4895
},
4996
],
97+
'@typescript-eslint/unified-signatures': [2],
98+
'@typescript-eslint/no-unnecessary-type-parameters': [2],
99+
'@typescript-eslint/no-invalid-void-type': [2],
100+
'@typescript-eslint/no-confusing-void-expression': [2],
101+
'@typescript-eslint/no-duplicate-type-constituents': [2],
102+
'@typescript-eslint/require-await': [2],
103+
'@typescript-eslint/no-redundant-type-constituents': [2],
104+
'@typescript-eslint/no-unnecessary-type-arguments': [2],
105+
'@typescript-eslint/no-unnecessary-type-assertion': [2],
106+
'@typescript-eslint/prefer-nullish-coalescing': [2],
107+
'@typescript-eslint/no-inferrable-types': [2],
108+
'object-shorthand': [2],
109+
110+
'no-undef': [0],
111+
'@typescript-eslint/no-unused-vars': [
112+
0,
113+
{
114+
vars: 'all',
115+
args: 'after-used',
116+
caughtErrors: 'all',
117+
ignoreRestSiblings: false,
118+
reportUsedIgnorePattern: false,
119+
},
120+
],
121+
'@typescript-eslint/ban-ts-comment': [
122+
0,
123+
[
124+
{
125+
'ts-expect-error': 'allow-with-description',
126+
'ts-ignore': true,
127+
'ts-nocheck': true,
128+
'ts-check': false,
129+
minimumDescriptionLength: 3,
130+
},
131+
],
132+
],
133+
'vitest/valid-title': [0],
134+
'vitest/no-alias-methods': [2],
135+
'vitest/no-disabled-tests': [2],
136+
'vitest/no-focused-tests': [2],
137+
'vitest/no-test-prefixes': [2],
138+
'vitest/no-test-return-statement': [2],
139+
'vitest/prefer-each': [2],
140+
'vitest/prefer-spy-on': [2],
141+
'vitest/prefer-to-be': [2],
142+
'vitest/prefer-to-contain': [2],
143+
'vitest/prefer-to-have-length': [2],
50144
},
145+
146+
settings: {
147+
vitest: {
148+
typecheck: true,
149+
},
150+
},
151+
51152
linterOptions: { reportUnusedDisableDirectives: 2 },
52153
},
53154
{
54155
name: 'commonjs',
55156
files: ['**/*.c[jt]s'],
56157
languageOptions: { sourceType: 'commonjs' },
57158
rules: {
58-
'@typescript-eslint/no-require-imports': [0],
159+
'@typescript-eslint/no-require-imports': [
160+
0,
161+
[{ allow: [], allowAsImport: false }],
162+
],
59163
},
60164
},
165+
166+
prettierConfig,
61167
)
62168

63-
export default ESLintConfig
169+
export default eslintConfig

0 commit comments

Comments
 (0)