Skip to content

Commit 08b03b4

Browse files
committed
Make reselect-codemods a Yarn workspace
1 parent 71909bd commit 08b03b4

29 files changed

+2927
-4473
lines changed

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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 14 additions & 8 deletions
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

Lines changed: 0 additions & 39 deletions
This file was deleted.

codemods/eslint.config.mts

Lines changed: 225 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,263 @@
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 },
8-
...configs.recommended,
9-
...configs.stylistic,
10-
{ name: 'prettier-config', ...prettierConfig },
7+
const eslintConfig: ConfigArray = config(
8+
{
9+
name: 'global-ignores',
10+
ignores: [
11+
'**/dist/',
12+
'**/build/',
13+
'**/lib/',
14+
'**/coverage/',
15+
'**/__snapshots__/',
16+
'**/temp/',
17+
'**/.temp/',
18+
'**/.tmp/',
19+
'**/.yalc/',
20+
'**/.yarn/',
21+
'**/.docusaurus/',
22+
'**/.next/',
23+
'**/__testfixtures__/',
24+
],
25+
},
26+
{
27+
name: `${js.meta.name}/recommended`,
28+
...js.configs.recommended,
29+
},
30+
31+
configs.recommended,
32+
configs.stylistic,
33+
34+
vitestPlugin.configs.recommended,
35+
vitestPlugin.configs.env,
36+
1137
{
1238
name: 'main',
1339
languageOptions: {
1440
parser,
1541
parserOptions: {
16-
projectService: {
17-
defaultProject: './tsconfig.json',
18-
},
1942
ecmaVersion: 'latest',
43+
projectService: true,
44+
tsconfigRootDir: import.meta.dirname,
2045
},
2146
},
2247
rules: {
23-
'no-undef': [0],
2448
'@typescript-eslint/consistent-type-imports': [
2549
2,
26-
{ fixStyle: 'separate-type-imports', disallowTypeAnnotations: false },
50+
{
51+
disallowTypeAnnotations: true,
52+
fixStyle: 'separate-type-imports',
53+
prefer: 'type-imports',
54+
},
55+
],
56+
'@typescript-eslint/consistent-type-exports': [
57+
2,
58+
{ fixMixedExportsWithInlineTypeSpecifier: false },
59+
],
60+
'@typescript-eslint/no-explicit-any': [
61+
2,
62+
{
63+
fixToUnknown: false,
64+
ignoreRestArgs: false,
65+
},
2766
],
28-
'@typescript-eslint/consistent-type-exports': [2],
29-
'@typescript-eslint/no-unused-vars': [0],
30-
'@typescript-eslint/no-explicit-any': [0],
3167
'@typescript-eslint/no-empty-object-type': [
3268
2,
33-
{ allowInterfaces: 'with-single-extends' },
69+
{
70+
allowInterfaces: 'never',
71+
allowObjectTypes: 'never',
72+
},
73+
],
74+
'@typescript-eslint/no-restricted-types': [
75+
2,
76+
{
77+
types: {
78+
'{}': {
79+
message: `
80+
- If you want to represent an empty object, use \`type EmptyObject = Record<string, never>\`.
81+
- If you want to represent an object literal, use either \`type AnyObject = Record<string, any>\` or \`object\`.
82+
- If you want to represent any non-nullish value, use \`type AnyNonNullishValue = NonNullable<unknown>\`.`,
83+
suggest: [
84+
'AnyNonNullishValue',
85+
'EmptyObject',
86+
'AnyObject',
87+
'object',
88+
'Record<string, never>',
89+
'Record<string, any>',
90+
'NonNullable<unknown>',
91+
],
92+
},
93+
},
94+
},
3495
],
3596
'@typescript-eslint/no-namespace': [
3697
2,
37-
{ allowDeclarations: true, allowDefinitionFiles: true },
98+
{
99+
allowDeclarations: false,
100+
allowDefinitionFiles: true,
101+
},
38102
],
39-
'@typescript-eslint/ban-ts-comment': [0],
103+
'@typescript-eslint/consistent-type-definitions': [2, 'type'],
40104
'sort-imports': [
41105
2,
42106
{
107+
allowSeparatedGroups: true,
43108
ignoreCase: false,
44109
ignoreDeclarationSort: true,
45110
ignoreMemberSort: false,
46111
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
47-
allowSeparatedGroups: true,
48112
},
49113
],
114+
'@typescript-eslint/unified-signatures': [
115+
2,
116+
{
117+
ignoreDifferentlyNamedParameters: false,
118+
ignoreOverloadsWithDifferentJSDoc: false,
119+
},
120+
],
121+
'@typescript-eslint/no-unnecessary-type-parameters': [2],
122+
'@typescript-eslint/no-invalid-void-type': [
123+
2,
124+
{
125+
allowAsThisParameter: false,
126+
allowInGenericTypeArguments: true,
127+
},
128+
],
129+
'@typescript-eslint/no-confusing-void-expression': [
130+
2,
131+
{
132+
ignoreArrowShorthand: false,
133+
ignoreVoidOperator: false,
134+
ignoreVoidReturningFunctions: false,
135+
},
136+
],
137+
'@typescript-eslint/no-duplicate-type-constituents': [
138+
2,
139+
{
140+
ignoreIntersections: false,
141+
ignoreUnions: false,
142+
},
143+
],
144+
'@typescript-eslint/require-await': [2],
145+
'@typescript-eslint/no-redundant-type-constituents': [2],
146+
'@typescript-eslint/no-unnecessary-type-arguments': [2],
147+
'@typescript-eslint/no-unnecessary-type-assertion': [
148+
2,
149+
{ typesToIgnore: [] },
150+
],
151+
'@typescript-eslint/prefer-nullish-coalescing': [
152+
2,
153+
{
154+
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
155+
ignoreBooleanCoercion: false,
156+
ignoreConditionalTests: true,
157+
ignoreIfStatements: false,
158+
ignoreMixedLogicalExpressions: false,
159+
ignorePrimitives: {
160+
bigint: false,
161+
boolean: false,
162+
number: false,
163+
string: false,
164+
},
165+
ignoreTernaryTests: false,
166+
},
167+
],
168+
'@typescript-eslint/no-inferrable-types': [
169+
2,
170+
{
171+
ignoreParameters: false,
172+
ignoreProperties: false,
173+
},
174+
],
175+
'@typescript-eslint/no-require-imports': [
176+
2,
177+
{
178+
allow: [],
179+
allowAsImport: true,
180+
},
181+
],
182+
'object-shorthand': [
183+
2,
184+
'always',
185+
{
186+
avoidQuotes: true,
187+
ignoreConstructors: true,
188+
methodsIgnorePattern: '',
189+
avoidExplicitReturnArrows: true,
190+
},
191+
],
192+
193+
'no-undef': [0, { typeof: false }],
194+
'@typescript-eslint/no-unused-vars': [
195+
0,
196+
{
197+
args: 'all',
198+
argsIgnorePattern: '^_',
199+
caughtErrors: 'all',
200+
caughtErrorsIgnorePattern: '^_',
201+
destructuredArrayIgnorePattern: '^_',
202+
varsIgnorePattern: '^_',
203+
ignoreRestSiblings: true,
204+
},
205+
],
206+
'@typescript-eslint/ban-ts-comment': [
207+
0,
208+
{
209+
'ts-expect-error': 'allow-with-description',
210+
'ts-ignore': true,
211+
'ts-nocheck': true,
212+
'ts-check': false,
213+
minimumDescriptionLength: 3,
214+
},
215+
],
216+
217+
'vitest/valid-title': [0],
218+
219+
'vitest/no-alias-methods': [2],
220+
'vitest/no-disabled-tests': [2],
221+
'vitest/no-focused-tests': [2],
222+
'vitest/no-test-prefixes': [2],
223+
'vitest/no-test-return-statement': [2],
224+
'vitest/prefer-each': [2],
225+
'vitest/prefer-spy-on': [2],
226+
'vitest/prefer-to-be': [2],
227+
'vitest/prefer-to-contain': [2],
228+
'vitest/prefer-to-have-length': [2],
229+
'vitest/prefer-describe-function-title': [2],
230+
},
231+
232+
settings: {
233+
vitest: {
234+
typecheck: true,
235+
},
236+
},
237+
238+
linterOptions: {
239+
reportUnusedDisableDirectives: 2,
50240
},
51-
linterOptions: { reportUnusedDisableDirectives: 2 },
52241
},
242+
53243
{
54-
name: 'commonjs',
55-
files: ['**/*.c[jt]s'],
56-
languageOptions: { sourceType: 'commonjs' },
244+
name: 'commonjs-files',
245+
files: ['**/*.cjs'],
246+
languageOptions: {
247+
sourceType: 'commonjs',
248+
},
57249
rules: {
58-
'@typescript-eslint/no-require-imports': [0],
250+
'@typescript-eslint/no-require-imports': [
251+
0,
252+
{
253+
allow: [],
254+
allowAsImport: false,
255+
},
256+
],
59257
},
60258
},
259+
260+
prettierConfig,
61261
)
62262

63-
export default ESLintConfig
263+
export default eslintConfig

0 commit comments

Comments
 (0)