eslint-config-typed 4.0.8 → 4.1.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/dist/configs/plugins.d.mts +1 -1
- package/dist/configs/plugins.d.mts.map +1 -1
- package/dist/configs/plugins.mjs +2 -0
- package/dist/configs/plugins.mjs.map +1 -1
- package/dist/configs/typescript.d.mts.map +1 -1
- package/dist/configs/typescript.mjs +2 -0
- package/dist/configs/typescript.mjs.map +1 -1
- package/dist/entry-point.mjs +2 -0
- package/dist/entry-point.mjs.map +1 -1
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/immer-coding-style/index.d.mts +2 -0
- package/dist/plugins/immer-coding-style/index.d.mts.map +1 -0
- package/dist/plugins/immer-coding-style/index.mjs +2 -0
- package/dist/plugins/immer-coding-style/index.mjs.map +1 -0
- package/dist/plugins/immer-coding-style/plugin.d.mts +3 -0
- package/dist/plugins/immer-coding-style/plugin.d.mts.map +1 -0
- package/dist/plugins/immer-coding-style/plugin.mjs +8 -0
- package/dist/plugins/immer-coding-style/plugin.mjs.map +1 -0
- package/dist/plugins/immer-coding-style/rules/index.d.mts +2 -0
- package/dist/plugins/immer-coding-style/rules/index.d.mts.map +1 -0
- package/dist/plugins/immer-coding-style/rules/index.mjs +2 -0
- package/dist/plugins/immer-coding-style/rules/index.mjs.map +1 -0
- package/dist/plugins/immer-coding-style/rules/prefer-curried-produce.d.mts +5 -0
- package/dist/plugins/immer-coding-style/rules/prefer-curried-produce.d.mts.map +1 -0
- package/dist/plugins/immer-coding-style/rules/prefer-curried-produce.mjs +158 -0
- package/dist/plugins/immer-coding-style/rules/prefer-curried-produce.mjs.map +1 -0
- package/dist/plugins/immer-coding-style/rules/rules.d.mts +4 -0
- package/dist/plugins/immer-coding-style/rules/rules.d.mts.map +1 -0
- package/dist/plugins/immer-coding-style/rules/rules.mjs +8 -0
- package/dist/plugins/immer-coding-style/rules/rules.mjs.map +1 -0
- package/dist/plugins/index.d.mts +1 -0
- package/dist/plugins/index.d.mts.map +1 -1
- package/dist/plugins/index.mjs +1 -0
- package/dist/plugins/index.mjs.map +1 -1
- package/dist/rules/eslint-immer-coding-style-rules.d.mts +4 -0
- package/dist/rules/eslint-immer-coding-style-rules.d.mts.map +1 -0
- package/dist/rules/eslint-immer-coding-style-rules.mjs +6 -0
- package/dist/rules/eslint-immer-coding-style-rules.mjs.map +1 -0
- package/dist/rules/index.d.mts +1 -0
- package/dist/rules/index.d.mts.map +1 -1
- package/dist/rules/index.mjs +1 -0
- package/dist/rules/index.mjs.map +1 -1
- package/dist/types/define-known-rules.d.mts +2 -2
- package/dist/types/define-known-rules.d.mts.map +1 -1
- package/dist/types/define-known-rules.mjs.map +1 -1
- package/dist/types/rules/eslint-immer-coding-style-rules.d.mts +20 -0
- package/dist/types/rules/eslint-immer-coding-style-rules.d.mts.map +1 -0
- package/dist/types/rules/eslint-immer-coding-style-rules.mjs +2 -0
- package/dist/types/rules/eslint-immer-coding-style-rules.mjs.map +1 -0
- package/dist/types/rules/index.d.mts +1 -0
- package/dist/types/rules/index.d.mts.map +1 -1
- package/package.json +5 -4
- package/src/configs/plugins.mts +3 -0
- package/src/configs/typescript.mts +2 -0
- package/src/plugins/immer-coding-style/index.mts +1 -0
- package/src/plugins/immer-coding-style/plugin.mts +6 -0
- package/src/plugins/immer-coding-style/rules/index.mts +1 -0
- package/src/plugins/immer-coding-style/rules/prefer-curried-produce.mts +293 -0
- package/src/plugins/immer-coding-style/rules/prefer-curried-produce.test.mts +124 -0
- package/src/plugins/immer-coding-style/rules/rules.mts +6 -0
- package/src/plugins/index.mts +1 -0
- package/src/rules/eslint-immer-coding-style-rules.mts +5 -0
- package/src/rules/index.mts +1 -0
- package/src/types/define-known-rules.mts +2 -0
- package/src/types/rules/eslint-immer-coding-style-rules.mts +21 -0
- package/src/types/rules/index.mts +1 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ESLintPlugin } from '../types/index.mjs';
|
|
2
|
-
export declare const plugins: Record<'@typescript-eslint' | '@stylistic' | 'array-func' | 'cypress' | 'playwright' | 'functional' | 'import-x' | 'jest' | 'vitest' | 'jsx-a11y' | 'math' | 'prefer-arrow-functions' | 'promise' | 'n' | 'react' | 'react-hooks' | 'react-refresh' | 'react-perf' | 'security' | 'testing-library' | 'unicorn' | 'sort-destructure-keys' | 'eslint-plugin' | 'tree-shakable' | 'total-functions' | 'strict-dependencies' | 'ts-restrictions' | 'react-coding-style' | 'vitest-coding-style', Omit<ESLintPlugin, 'configs'>>;
|
|
2
|
+
export declare const plugins: Record<'@typescript-eslint' | '@stylistic' | 'array-func' | 'cypress' | 'playwright' | 'functional' | 'import-x' | 'jest' | 'vitest' | 'jsx-a11y' | 'math' | 'prefer-arrow-functions' | 'promise' | 'n' | 'react' | 'react-hooks' | 'react-refresh' | 'react-perf' | 'security' | 'testing-library' | 'unicorn' | 'sort-destructure-keys' | 'eslint-plugin' | 'tree-shakable' | 'total-functions' | 'strict-dependencies' | 'ts-restrictions' | 'react-coding-style' | 'immer-coding-style' | 'vitest-coding-style', Omit<ESLintPlugin, 'configs'>>;
|
|
3
3
|
//# sourceMappingURL=plugins.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.mts","sourceRoot":"","sources":["../../src/configs/plugins.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugins.d.mts","sourceRoot":"","sources":["../../src/configs/plugins.mts"],"names":[],"mappings":"AAkEA,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,oBAAoB,CAAC;AAExE,eAAO,MAAM,OAAO,EAAE,MAAM,CACxB,oBAAoB,GACpB,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,MAAM,GACN,QAAQ,GACR,UAAU,GACV,MAAM,GACN,wBAAwB,GACxB,SAAS,GACT,GAAG,GACH,OAAO,GACP,aAAa,GACb,eAAe,GACf,YAAY,GACZ,UAAU,GACV,iBAAiB,GACjB,SAAS,GACT,uBAAuB,GACvB,eAAe,GACf,eAAe,GACf,iBAAiB,GACjB,qBAAqB,GACrB,iBAAiB,GACjB,oBAAoB,GACpB,oBAAoB,GACpB,qBAAqB,EACvB,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAuCW,CAAC"}
|
package/dist/configs/plugins.mjs
CHANGED
|
@@ -21,6 +21,7 @@ import eslintPluginReactPerf from 'eslint-plugin-react-perf';
|
|
|
21
21
|
import eslintPluginJsxA11y from 'eslint-plugin-jsx-a11y';
|
|
22
22
|
import eslintPluginMath from 'eslint-plugin-math';
|
|
23
23
|
import eslintPluginEslintPlugin from 'eslint-plugin-eslint-plugin';
|
|
24
|
+
import { eslintPluginImmerCodingStyle } from '../plugins/immer-coding-style/plugin.mjs';
|
|
24
25
|
import { eslintPluginReactCodingStyle } from '../plugins/react-coding-style/plugin.mjs';
|
|
25
26
|
import { eslintPluginStrictDependencies } from '../plugins/strict-dependencies/plugin.mjs';
|
|
26
27
|
import { eslintPluginTotalFunctions } from '../plugins/total-functions/plugin.mjs';
|
|
@@ -66,6 +67,7 @@ const plugins = {
|
|
|
66
67
|
'strict-dependencies': eslintPluginStrictDependencies,
|
|
67
68
|
'ts-restrictions': eslintPluginTsRestrictions,
|
|
68
69
|
'react-coding-style': eslintPluginReactCodingStyle,
|
|
70
|
+
'immer-coding-style': eslintPluginImmerCodingStyle,
|
|
69
71
|
'vitest-coding-style': eslintPluginVitestCodingStyle,
|
|
70
72
|
};
|
|
71
73
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.mjs","sources":["../../src/configs/plugins.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugins.mjs","sources":["../../src/configs/plugins.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAmEO,MAAM,OAAO,GAgChB;AACF,IAAA,oBAAoB,EAAE,gBAAgB;AACtC,IAAA,YAAY,EAAE,SAAS;;AAEvB,IAAA,YAAY,EAAE,qBAAqB;AACnC,IAAA,OAAO,EAAE,mBAAmB;AAC5B,IAAA,UAAU,EAAE,sBAAsB;AAClC,IAAA,UAAU,EAAE,sBAAsB;;AAElC,IAAA,uBAAuB,EAAE,+BAA+B;AACxD,IAAA,UAAU,EAAE,kBAAkB;AAC9B,IAAA,IAAI,EAAE,gBAAgB;AACtB,IAAA,MAAM,EAAE,kBAAkB;;AAE1B,IAAA,UAAU,EAAE,mBAAmB;AAC/B,IAAA,IAAI,EAAE,gBAAgB;AACtB,IAAA,wBAAwB,EAAE,gCAAgC;;AAE1D,IAAA,OAAO,EAAE,mBAAmB;AAC5B,IAAA,CAAC,EAAE,aAAa;AAChB,IAAA,KAAK,EAAE,iBAAiB;;AAExB,IAAA,aAAa,EAAE,sBAAiD;AAChE,IAAA,eAAe,EAAE,wBAAwB;;AAEzC,IAAA,YAAY,EAAE,qBAAqB;;AAEnC,IAAA,QAAQ,EAAE,oBAAoB;AAC9B,IAAA,iBAAiB,EAAE,0BAA0B;AAC7C,IAAA,OAAO,EAAE,mBAAmB;AAC5B,IAAA,eAAe,EAAE,wBAAwB;AACzC,IAAA,eAAe,EAAE,wBAAwB;AACzC,IAAA,iBAAiB,EAAE,0BAA0B;AAC7C,IAAA,qBAAqB,EAAE,8BAA8B;AACrD,IAAA,iBAAiB,EAAE,0BAA0B;AAC7C,IAAA,oBAAoB,EAAE,4BAA4B;AAClD,IAAA,oBAAoB,EAAE,4BAA4B;AAClD,IAAA,qBAAqB,EAAE,6BAA6B;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.mts","sourceRoot":"","sources":["../../src/configs/typescript.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript.d.mts","sourceRoot":"","sources":["../../src/configs/typescript.mts"],"names":[],"mappings":"AAmBA,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGvE,eAAO,MAAM,yBAAyB,GAAI,8EAMvC,QAAQ,CAAC;IACV,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC,KAAG,SAAS,UAAU,EA8FZ,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { allExtensionsStr } from '../constants/all-extensions.mjs';
|
|
|
2
2
|
import { eslintArrayFuncRules } from '../rules/eslint-array-func-rules.mjs';
|
|
3
3
|
import { defineKnownRules } from '../types/define-known-rules.mjs';
|
|
4
4
|
import { eslintFunctionalRules } from '../rules/eslint-functional-rules.mjs';
|
|
5
|
+
import { eslintImmerCodingStyleRules } from '../rules/eslint-immer-coding-style-rules.mjs';
|
|
5
6
|
import { eslintImportsRules } from '../rules/eslint-import-rules.mjs';
|
|
6
7
|
import { eslintMathRules } from '../rules/eslint-math-rules.mjs';
|
|
7
8
|
import { eslintPluginSortDestructureKeysRules } from '../rules/eslint-plugin-sort-destructure-keys-rules.mjs';
|
|
@@ -40,6 +41,7 @@ const eslintConfigForTypeScript = ({ files, packageDirs, tsconfigFileName, tscon
|
|
|
40
41
|
...eslintTreeShakableRules,
|
|
41
42
|
...eslintPluginSortDestructureKeysRules,
|
|
42
43
|
...eslintTsRestrictionsRules,
|
|
44
|
+
...eslintImmerCodingStyleRules,
|
|
43
45
|
'strict-dependencies/strict-dependencies': ['error', []],
|
|
44
46
|
'import-x/no-extraneous-dependencies': [
|
|
45
47
|
'error',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.mjs","sources":["../../src/configs/typescript.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript.mjs","sources":["../../src/configs/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AAA;AACD,IAAA;QACE,KAAK,EAAE,CAAC,qBAAqB,CAAC;QAC9B,KAAK,EAAE,gBAAgB,CAAC;AACtB,YAAA,2CAA2C,EAAE,KAAK;;AAGlD,YAAA,gDAAgD,EAAE,KAAK;AAEvD,YAAA,sBAAsB,EAAE,KAAK;SAC9B,CAAC;AACH,KAAA;AACD,IAAA;AACE,QAAA,KAAK,EAAE,CAAC,CAAA,UAAA,EAAa,gBAAgB,GAAG,CAAC;QACzC,KAAK,EAAE,gBAAgB,CAAC;AACtB,YAAA,4CAA4C,EAAE,KAAK;SACpD,CAAC;AACH,KAAA;AACD,IAAA;AACE,QAAA,KAAK,EAAE;;;;;;;;YASL,qCAAqC;YAErC,uCAAuC;YAEvC,4CAA4C;YAC5C,gDAAgD;YAChD,qCAAqC;AACtC,SAAA;QACD,KAAK,EAAE,gBAAgB,CAAC;AACtB,YAAA,0CAA0C,EAAE,KAAK;AACjD,YAAA,4BAA4B,EAAE,KAAK;AACnC,YAAA,sCAAsC,EAAE,KAAK;AAC7C,YAAA,8BAA8B,EAAE,KAAK;AACrC,YAAA,8BAA8B,EAAE,KAAK;AACrC,YAAA,oBAAoB,EAAE,KAAK;SAC5B,CAAC;AACH,KAAA;;;;;"}
|
package/dist/entry-point.mjs
CHANGED
|
@@ -10,6 +10,7 @@ export { eslintConfigForTestingLibrary } from './configs/testing-library.mjs';
|
|
|
10
10
|
export { eslintConfigForTypeScriptWithoutRules } from './configs/typescript-without-rules.mjs';
|
|
11
11
|
export { eslintConfigForTypeScript } from './configs/typescript.mjs';
|
|
12
12
|
export { eslintConfigForVitest } from './configs/vitest.mjs';
|
|
13
|
+
export { eslintPluginImmerCodingStyle } from './plugins/immer-coding-style/plugin.mjs';
|
|
13
14
|
export { eslintPluginReactCodingStyle } from './plugins/react-coding-style/plugin.mjs';
|
|
14
15
|
export { eslintPluginStrictDependencies } from './plugins/strict-dependencies/plugin.mjs';
|
|
15
16
|
export { eslintPluginTotalFunctions } from './plugins/total-functions/plugin.mjs';
|
|
@@ -19,6 +20,7 @@ export { eslintPluginVitestCodingStyle } from './plugins/vitest-coding-style/plu
|
|
|
19
20
|
export { eslintArrayFuncRules } from './rules/eslint-array-func-rules.mjs';
|
|
20
21
|
export { eslintCypressRules } from './rules/eslint-cypress-rules.mjs';
|
|
21
22
|
export { eslintFunctionalRules } from './rules/eslint-functional-rules.mjs';
|
|
23
|
+
export { eslintImmerCodingStyleRules } from './rules/eslint-immer-coding-style-rules.mjs';
|
|
22
24
|
export { eslintImportsRules } from './rules/eslint-import-rules.mjs';
|
|
23
25
|
export { eslintJestRules } from './rules/eslint-jest-rules.mjs';
|
|
24
26
|
export { eslintJsxA11yRules } from './rules/eslint-jsx-a11y-rules.mjs';
|
package/dist/entry-point.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-point.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entry-point.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -10,6 +10,7 @@ export { eslintConfigForTestingLibrary } from './configs/testing-library.mjs';
|
|
|
10
10
|
export { eslintConfigForTypeScriptWithoutRules } from './configs/typescript-without-rules.mjs';
|
|
11
11
|
export { eslintConfigForTypeScript } from './configs/typescript.mjs';
|
|
12
12
|
export { eslintConfigForVitest } from './configs/vitest.mjs';
|
|
13
|
+
export { eslintPluginImmerCodingStyle } from './plugins/immer-coding-style/plugin.mjs';
|
|
13
14
|
export { eslintPluginReactCodingStyle } from './plugins/react-coding-style/plugin.mjs';
|
|
14
15
|
export { eslintPluginStrictDependencies } from './plugins/strict-dependencies/plugin.mjs';
|
|
15
16
|
export { eslintPluginTotalFunctions } from './plugins/total-functions/plugin.mjs';
|
|
@@ -19,6 +20,7 @@ export { eslintPluginVitestCodingStyle } from './plugins/vitest-coding-style/plu
|
|
|
19
20
|
export { eslintArrayFuncRules } from './rules/eslint-array-func-rules.mjs';
|
|
20
21
|
export { eslintCypressRules } from './rules/eslint-cypress-rules.mjs';
|
|
21
22
|
export { eslintFunctionalRules } from './rules/eslint-functional-rules.mjs';
|
|
23
|
+
export { eslintImmerCodingStyleRules } from './rules/eslint-immer-coding-style-rules.mjs';
|
|
22
24
|
export { eslintImportsRules } from './rules/eslint-import-rules.mjs';
|
|
23
25
|
export { eslintJestRules } from './rules/eslint-jest-rules.mjs';
|
|
24
26
|
export { eslintJsxA11yRules } from './rules/eslint-jsx-a11y-rules.mjs';
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/plugins/immer-coding-style/index.mts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","sourceRoot":"","sources":["../../../src/plugins/immer-coding-style/plugin.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1D,eAAO,MAAM,4BAA4B,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,CAE7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.mjs","sources":["../../../src/plugins/immer-coding-style/plugin.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAGO,MAAM,4BAA4B,GAAkC;AACzE,IAAA,KAAK,EAAE,qBAAqB;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/plugins/immer-coding-style/rules/index.mts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-curried-produce.d.mts","sourceRoot":"","sources":["../../../../src/plugins/immer-coding-style/rules/prefer-curried-produce.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EAEd,MAAM,0BAA0B,CAAC;AAGlC,KAAK,UAAU,GAAG,mBAAmB,CAAC;AAOtC,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU,CAmEpE,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
import { castDeepMutable, isRecord, hasKey } from 'ts-data-forge';
|
|
3
|
+
|
|
4
|
+
const preferCurriedProduceRule = {
|
|
5
|
+
meta: {
|
|
6
|
+
type: 'suggestion',
|
|
7
|
+
docs: {
|
|
8
|
+
description: 'Prefer the curried overload of immer produce for shorter updater definitions.',
|
|
9
|
+
},
|
|
10
|
+
fixable: 'code',
|
|
11
|
+
schema: [],
|
|
12
|
+
messages: {
|
|
13
|
+
useCurriedProduce: 'Use the curried overload of `produce`: `produce(recipe)` instead of `(state) => produce(state, recipe)`.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
create: (context) => {
|
|
17
|
+
const sourceCode = context.sourceCode;
|
|
18
|
+
return {
|
|
19
|
+
ArrowFunctionExpression: (node) => {
|
|
20
|
+
if (node.params.length !== 1) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const param = node.params[0];
|
|
24
|
+
if (param === undefined ||
|
|
25
|
+
param.type !== AST_NODE_TYPES.Identifier ||
|
|
26
|
+
param.name.length === 0) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const { name: parameterName } = param;
|
|
30
|
+
const callExpression = node.body;
|
|
31
|
+
if (!isProduceCall(callExpression)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const [baseArgument, ...restArguments] = callExpression.arguments;
|
|
35
|
+
if (baseArgument === undefined ||
|
|
36
|
+
restArguments.length === 0 ||
|
|
37
|
+
!isSameIdentifier(baseArgument, parameterName)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (hasOtherReferences(context, parameterName, baseArgument)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
report(context, {
|
|
44
|
+
arrowFunction: node,
|
|
45
|
+
callExpression,
|
|
46
|
+
remainingArguments: restArguments,
|
|
47
|
+
sourceCode,
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
defaultOptions: [],
|
|
53
|
+
};
|
|
54
|
+
const report = (context, { arrowFunction, callExpression, remainingArguments, sourceCode, }) => {
|
|
55
|
+
const calleeText = sourceCode.getText(castDeepMutable(callExpression.callee));
|
|
56
|
+
const typeParametersText = getTypeParametersText({
|
|
57
|
+
arrowFunction,
|
|
58
|
+
callExpression,
|
|
59
|
+
sourceCode,
|
|
60
|
+
});
|
|
61
|
+
const remainingArgumentsText = remainingArguments
|
|
62
|
+
.map((argument) => normalizeMultilineText(sourceCode.getText(castDeepMutable(argument))))
|
|
63
|
+
.join(', ');
|
|
64
|
+
const replacement = `${calleeText}${typeParametersText}(${remainingArgumentsText})`;
|
|
65
|
+
context.report({
|
|
66
|
+
node: castDeepMutable(arrowFunction),
|
|
67
|
+
messageId: 'useCurriedProduce',
|
|
68
|
+
fix: (fixer) => fixer.replaceText(castDeepMutable(arrowFunction), replacement),
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
const isProduceCall = (node) => {
|
|
72
|
+
if (node.type !== AST_NODE_TYPES.CallExpression) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
return (node.callee.type === AST_NODE_TYPES.Identifier &&
|
|
76
|
+
node.callee.name === 'produce');
|
|
77
|
+
};
|
|
78
|
+
const isSameIdentifier = (node, expectedName) => node.type === AST_NODE_TYPES.Identifier && node.name === expectedName;
|
|
79
|
+
const hasOtherReferences = (context, parameterName, baseIdentifier) => {
|
|
80
|
+
const scope = context.sourceCode.getScope(castDeepMutable(baseIdentifier));
|
|
81
|
+
const variable = scope.variables.find((variableItem) => variableItem.name === parameterName);
|
|
82
|
+
if (variable === undefined) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return variable.references.some((reference) => reference.identifier !== baseIdentifier);
|
|
86
|
+
};
|
|
87
|
+
const getTypeArguments = (node) => {
|
|
88
|
+
const mutableNode = castDeepMutable(node);
|
|
89
|
+
if (isRecord(mutableNode) && hasKey(mutableNode, 'typeArguments')) {
|
|
90
|
+
return mutableNode.typeArguments;
|
|
91
|
+
}
|
|
92
|
+
if (isRecord(mutableNode) && hasKey(mutableNode, 'typeParameters')) {
|
|
93
|
+
return mutableNode
|
|
94
|
+
.typeParameters;
|
|
95
|
+
}
|
|
96
|
+
return undefined;
|
|
97
|
+
};
|
|
98
|
+
const getTypeParametersText = ({ arrowFunction, callExpression, sourceCode, }) => {
|
|
99
|
+
const typeArguments = getTypeArguments(callExpression);
|
|
100
|
+
if (typeArguments !== undefined) {
|
|
101
|
+
return sourceCode.getText(castDeepMutable(typeArguments));
|
|
102
|
+
}
|
|
103
|
+
const parameterType = getArrowFunctionParameterType({
|
|
104
|
+
arrowFunction,
|
|
105
|
+
sourceCode,
|
|
106
|
+
});
|
|
107
|
+
if (parameterType !== undefined) {
|
|
108
|
+
return `<${parameterType}>`;
|
|
109
|
+
}
|
|
110
|
+
const returnType = getArrowFunctionReturnType({
|
|
111
|
+
arrowFunction,
|
|
112
|
+
sourceCode,
|
|
113
|
+
});
|
|
114
|
+
if (returnType !== undefined) {
|
|
115
|
+
return `<${returnType}>`;
|
|
116
|
+
}
|
|
117
|
+
return '';
|
|
118
|
+
};
|
|
119
|
+
const getArrowFunctionParameterType = ({ arrowFunction, sourceCode, }) => {
|
|
120
|
+
const [parameter] = arrowFunction.params;
|
|
121
|
+
if (parameter?.type !== AST_NODE_TYPES.Identifier) {
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
const typeAnnotation = parameter.typeAnnotation?.typeAnnotation;
|
|
125
|
+
if (typeAnnotation === undefined) {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
return sourceCode.getText(castDeepMutable(typeAnnotation));
|
|
129
|
+
};
|
|
130
|
+
const getArrowFunctionReturnType = ({ arrowFunction, sourceCode, }) => {
|
|
131
|
+
const typeAnnotation = arrowFunction.returnType?.typeAnnotation;
|
|
132
|
+
if (typeAnnotation === undefined) {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
return sourceCode.getText(castDeepMutable(typeAnnotation));
|
|
136
|
+
};
|
|
137
|
+
const normalizeMultilineText = (text) => {
|
|
138
|
+
const lines = text.split('\n');
|
|
139
|
+
if (lines.length <= 1) {
|
|
140
|
+
return text;
|
|
141
|
+
}
|
|
142
|
+
const indents = lines
|
|
143
|
+
.slice(1)
|
|
144
|
+
.filter((line) => line.trim().length > 0)
|
|
145
|
+
.map((line) => /^[\t ]*/u.exec(line)?.[0].length ?? 0);
|
|
146
|
+
if (indents.length === 0) {
|
|
147
|
+
return text;
|
|
148
|
+
}
|
|
149
|
+
const minIndent = Math.min(...indents);
|
|
150
|
+
if (minIndent === 0) {
|
|
151
|
+
return text;
|
|
152
|
+
}
|
|
153
|
+
const normalized = lines.map((line, index) => index === 0 ? line : line.slice(minIndent));
|
|
154
|
+
return normalized.join('\n');
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export { preferCurriedProduceRule };
|
|
158
|
+
//# sourceMappingURL=prefer-curried-produce.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-curried-produce.mjs","sources":["../../../../src/plugins/immer-coding-style/rules/prefer-curried-produce.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAcO,MAAM,wBAAwB,GAAoC;AACvE,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,YAAY;AAClB,QAAA,IAAI,EAAE;AACJ,YAAA,WAAW,EACT,+EAA+E;AAClF,SAAA;AACD,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,QAAQ,EAAE;AACR,YAAA,iBAAiB,EACf,0GAA0G;AAC7G,SAAA;AACF,KAAA;AACD,IAAA,MAAM,EAAE,CAAC,OAAO,KAAI;AAClB,QAAA,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU;QAErC,OAAO;AACL,YAAA,uBAAuB,EAAE,CACvB,IAAoD,KAClD;gBACF,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;oBAC5B;gBACF;gBAEA,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;gBAE5B,IACE,KAAK,KAAK,SAAS;AACnB,oBAAA,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU;AACxC,oBAAA,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EACvB;oBACA;gBACF;AAEA,gBAAA,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,KAAK;AAErC,gBAAA,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI;AAEhC,gBAAA,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE;oBAClC;gBACF;gBAEA,MAAM,CAAC,YAAY,EAAE,GAAG,aAAa,CAAC,GAAG,cAAc,CAAC,SAAS;gBAEjE,IACE,YAAY,KAAK,SAAS;o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,EAAE,cAAc;AAE/D,IAAA,IAAI,cAAc,KAAK,SAAS,EAAE;AAChC,QAAA,OAAO,SAAS;IAClB;IAEA,OAAO,UAAU,CAAC,OAAO,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,sBAAsB,GAAG,CAAC,IAAY,KAAY;IACtD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;AAE9B,IAAA,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE;AACrB,QAAA,OAAO,IAAI;IACb;IAEA,MAAM,OAAO,GAAG;SACb,KAAK,CAAC,CAAC;AACP,SAAA,MAAM,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;SACvC,GAAG,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC;AAExD,IAAA,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;AACxB,QAAA,OAAO,IAAI;IACb;IAEA,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;AAEtC,IAAA,IAAI,SAAS,KAAK,CAAC,EAAE;AACnB,QAAA,OAAO,IAAI;IACb;AAEA,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,KACvC,KAAK,KAAK,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAC3C;AAED,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9B,CAAC;;;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const immerCodingStyleRules: {
|
|
2
|
+
readonly 'prefer-curried-produce': import("@typescript-eslint/utils/ts-eslint").RuleModule<"useCurriedProduce", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
3
|
+
};
|
|
4
|
+
//# sourceMappingURL=rules.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.d.mts","sourceRoot":"","sources":["../../../../src/plugins/immer-coding-style/rules/rules.mts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB;;CAEQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.mjs","sources":["../../../../src/plugins/immer-coding-style/rules/rules.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAGO,MAAM,qBAAqB,GAAG;AACnC,IAAA,wBAAwB,EAAE,wBAAwB;;;;;"}
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/plugins/index.mts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/plugins/index.mts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC"}
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { eslintPluginImmerCodingStyle } from './immer-coding-style/plugin.mjs';
|
|
1
2
|
export { eslintPluginReactCodingStyle } from './react-coding-style/plugin.mjs';
|
|
2
3
|
export { eslintPluginStrictDependencies } from './strict-dependencies/plugin.mjs';
|
|
3
4
|
export { eslintPluginTotalFunctions } from './total-functions/plugin.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-immer-coding-style-rules.d.mts","sourceRoot":"","sources":["../../src/rules/eslint-immer-coding-style-rules.mts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B;;CAEQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-immer-coding-style-rules.mjs","sources":["../../src/rules/eslint-immer-coding-style-rules.mts"],"sourcesContent":[null],"names":[],"mappings":"AAEO,MAAM,2BAA2B,GAAG;AACzC,IAAA,2CAA2C,EAAE,OAAO;;;;;"}
|
package/dist/rules/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './eslint-array-func-rules.mjs';
|
|
2
2
|
export * from './eslint-cypress-rules.mjs';
|
|
3
3
|
export * from './eslint-functional-rules.mjs';
|
|
4
|
+
export * from './eslint-immer-coding-style-rules.mjs';
|
|
4
5
|
export * from './eslint-import-rules.mjs';
|
|
5
6
|
export * from './eslint-jest-rules.mjs';
|
|
6
7
|
export * from './eslint-jsx-a11y-rules.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/rules/index.mts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC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CAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC"}
|
package/dist/rules/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { eslintArrayFuncRules } from './eslint-array-func-rules.mjs';
|
|
2
2
|
export { eslintCypressRules } from './eslint-cypress-rules.mjs';
|
|
3
3
|
export { eslintFunctionalRules } from './eslint-functional-rules.mjs';
|
|
4
|
+
export { eslintImmerCodingStyleRules } from './eslint-immer-coding-style-rules.mjs';
|
|
4
5
|
export { eslintImportsRules } from './eslint-import-rules.mjs';
|
|
5
6
|
export { eslintJestRules } from './eslint-jest-rules.mjs';
|
|
6
7
|
export { eslintJsxA11yRules } from './eslint-jsx-a11y-rules.mjs';
|
package/dist/rules/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type EslintArrayFuncRules, type EslintCypressRules, type EslintFunctionalRules, type EslintImportsRules, type EslintJestRules, type EslintJsxA11yRules, type EslintMathRules, type EslintNRules, type EslintPlaywrightRules, type EslintPluginRules, type EslintPluginSortDestructureKeysRules, type EslintPreferArrowFunctionRules, type EslintPromiseRules, type EslintReactCodingStyleRules, type EslintReactHooksRules, type EslintReactPerfRules, type EslintReactRefreshRules, type EslintReactRules, type EslintRules, type EslintSecurityRules, type EslintStrictDependenciesRules, type EslintStylisticRules, type EslintTestingLibraryRules, type EslintTotalFunctionsRules, type EslintTreeShakableRules, type EslintTsRestrictionsRules, type EslintUnicornRules, type EslintVitestCodingStyleRules, type EslintVitestRules, type TypeScriptEslintRules } from './rules/index.mjs';
|
|
2
|
-
type KnownRules = DeepReadonly<EslintTsRestrictionsRules & EslintArrayFuncRules & EslintCypressRules & EslintFunctionalRules & EslintImportsRules & EslintJestRules & EslintJsxA11yRules & EslintMathRules & EslintPlaywrightRules & EslintPluginRules & EslintPluginSortDestructureKeysRules & EslintPreferArrowFunctionRules & EslintPromiseRules & EslintNRules & EslintReactHooksRules & EslintReactPerfRules & EslintReactRefreshRules & EslintReactRules & EslintRules & EslintStylisticRules & EslintSecurityRules & EslintStrictDependenciesRules & EslintTestingLibraryRules & EslintTotalFunctionsRules & EslintTreeShakableRules & EslintUnicornRules & EslintVitestRules & EslintVitestCodingStyleRules & EslintReactCodingStyleRules & TypeScriptEslintRules>;
|
|
1
|
+
import { type EslintArrayFuncRules, type EslintCypressRules, type EslintFunctionalRules, type EslintImmerCodingStyleRules, type EslintImportsRules, type EslintJestRules, type EslintJsxA11yRules, type EslintMathRules, type EslintNRules, type EslintPlaywrightRules, type EslintPluginRules, type EslintPluginSortDestructureKeysRules, type EslintPreferArrowFunctionRules, type EslintPromiseRules, type EslintReactCodingStyleRules, type EslintReactHooksRules, type EslintReactPerfRules, type EslintReactRefreshRules, type EslintReactRules, type EslintRules, type EslintSecurityRules, type EslintStrictDependenciesRules, type EslintStylisticRules, type EslintTestingLibraryRules, type EslintTotalFunctionsRules, type EslintTreeShakableRules, type EslintTsRestrictionsRules, type EslintUnicornRules, type EslintVitestCodingStyleRules, type EslintVitestRules, type TypeScriptEslintRules } from './rules/index.mjs';
|
|
2
|
+
type KnownRules = DeepReadonly<EslintTsRestrictionsRules & EslintArrayFuncRules & EslintCypressRules & EslintFunctionalRules & EslintImportsRules & EslintJestRules & EslintJsxA11yRules & EslintMathRules & EslintPlaywrightRules & EslintPluginRules & EslintPluginSortDestructureKeysRules & EslintPreferArrowFunctionRules & EslintPromiseRules & EslintNRules & EslintReactHooksRules & EslintReactPerfRules & EslintReactRefreshRules & EslintReactRules & EslintRules & EslintStylisticRules & EslintSecurityRules & EslintStrictDependenciesRules & EslintTestingLibraryRules & EslintTotalFunctionsRules & EslintTreeShakableRules & EslintUnicornRules & EslintVitestRules & EslintVitestCodingStyleRules & EslintImmerCodingStyleRules & EslintReactCodingStyleRules & TypeScriptEslintRules>;
|
|
3
3
|
export declare const defineKnownRules: (rules: Partial<KnownRules>) => Partial<KnownRules>;
|
|
4
4
|
export {};
|
|
5
5
|
//# sourceMappingURL=define-known-rules.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-known-rules.d.mts","sourceRoot":"","sources":["../../src/types/define-known-rules.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,oCAAoC,EACzC,KAAK,8BAA8B,EACnC,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAC;AAE3B,KAAK,UAAU,GAAG,YAAY,CAC5B,yBAAyB,GACvB,oBAAoB,GACpB,kBAAkB,GAClB,qBAAqB,GACrB,kBAAkB,GAClB,eAAe,GACf,kBAAkB,GAClB,eAAe,GACf,qBAAqB,GACrB,iBAAiB,GACjB,oCAAoC,GACpC,8BAA8B,GAC9B,kBAAkB,GAClB,YAAY,GACZ,qBAAqB,GACrB,oBAAoB,GACpB,uBAAuB,GACvB,gBAAgB,GAChB,WAAW,GACX,oBAAoB,GACpB,mBAAmB,GACnB,6BAA6B,GAC7B,yBAAyB,GACzB,yBAAyB,GACzB,uBAAuB,GACvB,kBAAkB,GAClB,iBAAiB,GACjB,4BAA4B,GAC5B,2BAA2B,GAC3B,qBAAqB,CACxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,OAAO,OAAO,CAAC,UAAU,CAAC,KACzB,OAAO,CAAC,UAAU,CAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"define-known-rules.d.mts","sourceRoot":"","sources":["../../src/types/define-known-rules.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,oCAAoC,EACzC,KAAK,8BAA8B,EACnC,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAC;AAE3B,KAAK,UAAU,GAAG,YAAY,CAC5B,yBAAyB,GACvB,oBAAoB,GACpB,kBAAkB,GAClB,qBAAqB,GACrB,kBAAkB,GAClB,eAAe,GACf,kBAAkB,GAClB,eAAe,GACf,qBAAqB,GACrB,iBAAiB,GACjB,oCAAoC,GACpC,8BAA8B,GAC9B,kBAAkB,GAClB,YAAY,GACZ,qBAAqB,GACrB,oBAAoB,GACpB,uBAAuB,GACvB,gBAAgB,GAChB,WAAW,GACX,oBAAoB,GACpB,mBAAmB,GACnB,6BAA6B,GAC7B,yBAAyB,GACzB,yBAAyB,GACzB,uBAAuB,GACvB,kBAAkB,GAClB,iBAAiB,GACjB,4BAA4B,GAC5B,2BAA2B,GAC3B,2BAA2B,GAC3B,qBAAqB,CACxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,OAAO,OAAO,CAAC,UAAU,CAAC,KACzB,OAAO,CAAC,UAAU,CAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-known-rules.mjs","sources":["../../src/types/define-known-rules.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"define-known-rules.mjs","sources":["../../src/types/define-known-rules.mts"],"sourcesContent":[null],"names":[],"mappings":"AAoEO,MAAM,gBAAgB,GAAG,CAC9B,KAA0B,KACF;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Linter } from 'eslint';
|
|
2
|
+
/**
|
|
3
|
+
* Prefer the curried overload of immer produce for shorter updater definitions.
|
|
4
|
+
*
|
|
5
|
+
* ```md
|
|
6
|
+
* | key | value |
|
|
7
|
+
* | :--------- | :--------- |
|
|
8
|
+
* | type | suggestion |
|
|
9
|
+
* | deprecated | false |
|
|
10
|
+
* | fixable | code |
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare namespace PreferCurriedProduce {
|
|
14
|
+
type RuleEntry = Linter.StringSeverity;
|
|
15
|
+
}
|
|
16
|
+
export type EslintImmerCodingStyleRules = Readonly<{
|
|
17
|
+
'immer-coding-style/prefer-curried-produce': PreferCurriedProduce.RuleEntry;
|
|
18
|
+
}>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=eslint-immer-coding-style-rules.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-immer-coding-style-rules.d.mts","sourceRoot":"","sources":["../../../src/types/rules/eslint-immer-coding-style-rules.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC;;;;;;;;;;GAUG;AACH,kBAAU,oBAAoB,CAAC;IAC7B,KAAY,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;CAC/C;AAED,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IACjD,2CAA2C,EAAE,oBAAoB,CAAC,SAAS,CAAC;CAC7E,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-immer-coding-style-rules.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './eslint-array-func-rules.mjs';
|
|
2
2
|
export * from './eslint-cypress-rules.mjs';
|
|
3
3
|
export * from './eslint-functional-rules.mjs';
|
|
4
|
+
export * from './eslint-immer-coding-style-rules.mjs';
|
|
4
5
|
export * from './eslint-import-rules.mjs';
|
|
5
6
|
export * from './eslint-jest-rules.mjs';
|
|
6
7
|
export * from './eslint-jsx-a11y-rules.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/types/rules/index.mts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBA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ACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-typed",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript"
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@typescript-eslint/parser": "8.48.1",
|
|
80
80
|
"@typescript-eslint/type-utils": "8.48.1",
|
|
81
81
|
"@typescript-eslint/utils": "8.48.1",
|
|
82
|
-
"@vitest/eslint-plugin": "^1.5.
|
|
82
|
+
"@vitest/eslint-plugin": "^1.5.2",
|
|
83
83
|
"eslint": "9.39.1",
|
|
84
84
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
85
85
|
"eslint-plugin-array-func": "5.1.0",
|
|
@@ -136,14 +136,15 @@
|
|
|
136
136
|
"dedent": "1.7.0",
|
|
137
137
|
"fast-glob": "3.3.3",
|
|
138
138
|
"github-settings-as-code": "1.0.6",
|
|
139
|
+
"immer": "^11.0.1",
|
|
139
140
|
"jiti": "2.6.1",
|
|
140
141
|
"json-schema": "0.4.0",
|
|
141
142
|
"json-schema-to-typescript": "15.0.4",
|
|
142
143
|
"markdownlint": "0.40.0",
|
|
143
|
-
"markdownlint-cli2": "0.
|
|
144
|
+
"markdownlint-cli2": "0.20.0",
|
|
144
145
|
"npm-run-all2": "8.0.4",
|
|
145
146
|
"prettier": "3.7.4",
|
|
146
|
-
"prettier-plugin-jsdoc": "1.
|
|
147
|
+
"prettier-plugin-jsdoc": "1.8.0",
|
|
147
148
|
"prettier-plugin-organize-imports": "4.3.0",
|
|
148
149
|
"prettier-plugin-packagejson": "2.5.20",
|
|
149
150
|
"react": "19.2.1",
|
package/src/configs/plugins.mts
CHANGED
|
@@ -55,6 +55,7 @@ import eslintPluginEslintPlugin from 'eslint-plugin-eslint-plugin';
|
|
|
55
55
|
// import eslintPluginTotalFunctions from 'eslint-plugin-total-functions';
|
|
56
56
|
// import eslintPluginTreeShakable from 'eslint-plugin-tree-shakable';
|
|
57
57
|
import {
|
|
58
|
+
eslintPluginImmerCodingStyle,
|
|
58
59
|
eslintPluginReactCodingStyle,
|
|
59
60
|
eslintPluginStrictDependencies,
|
|
60
61
|
eslintPluginTotalFunctions,
|
|
@@ -94,6 +95,7 @@ export const plugins: Record<
|
|
|
94
95
|
| 'strict-dependencies'
|
|
95
96
|
| 'ts-restrictions'
|
|
96
97
|
| 'react-coding-style'
|
|
98
|
+
| 'immer-coding-style'
|
|
97
99
|
| 'vitest-coding-style',
|
|
98
100
|
Omit<ESLintPlugin, 'configs'>
|
|
99
101
|
> = {
|
|
@@ -132,5 +134,6 @@ export const plugins: Record<
|
|
|
132
134
|
'strict-dependencies': eslintPluginStrictDependencies,
|
|
133
135
|
'ts-restrictions': eslintPluginTsRestrictions,
|
|
134
136
|
'react-coding-style': eslintPluginReactCodingStyle,
|
|
137
|
+
'immer-coding-style': eslintPluginImmerCodingStyle,
|
|
135
138
|
'vitest-coding-style': eslintPluginVitestCodingStyle,
|
|
136
139
|
} as const satisfies FlatConfig['plugins'];
|
|
@@ -2,6 +2,7 @@ import { allExtensionsStr } from '../constants/index.mjs';
|
|
|
2
2
|
import {
|
|
3
3
|
eslintArrayFuncRules,
|
|
4
4
|
eslintFunctionalRules,
|
|
5
|
+
eslintImmerCodingStyleRules,
|
|
5
6
|
eslintImportsRules,
|
|
6
7
|
eslintMathRules,
|
|
7
8
|
eslintPluginSortDestructureKeysRules,
|
|
@@ -55,6 +56,7 @@ export const eslintConfigForTypeScript = ({
|
|
|
55
56
|
...eslintTreeShakableRules,
|
|
56
57
|
...eslintPluginSortDestructureKeysRules,
|
|
57
58
|
...eslintTsRestrictionsRules,
|
|
59
|
+
...eslintImmerCodingStyleRules,
|
|
58
60
|
|
|
59
61
|
'strict-dependencies/strict-dependencies': ['error', []],
|
|
60
62
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './plugin.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './rules.mjs';
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AST_NODE_TYPES,
|
|
3
|
+
type TSESLint,
|
|
4
|
+
type TSESTree,
|
|
5
|
+
} from '@typescript-eslint/utils';
|
|
6
|
+
import { castDeepMutable, hasKey, isRecord } from 'ts-data-forge';
|
|
7
|
+
|
|
8
|
+
type MessageIds = 'useCurriedProduce';
|
|
9
|
+
|
|
10
|
+
type CallExpressionWithLegacyTypeParameters = TSESTree.CallExpression &
|
|
11
|
+
Readonly<{
|
|
12
|
+
typeParameters?: TSESTree.TSTypeParameterInstantiation;
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
export const preferCurriedProduceRule: TSESLint.RuleModule<MessageIds> = {
|
|
16
|
+
meta: {
|
|
17
|
+
type: 'suggestion',
|
|
18
|
+
docs: {
|
|
19
|
+
description:
|
|
20
|
+
'Prefer the curried overload of immer produce for shorter updater definitions.',
|
|
21
|
+
},
|
|
22
|
+
fixable: 'code',
|
|
23
|
+
schema: [],
|
|
24
|
+
messages: {
|
|
25
|
+
useCurriedProduce:
|
|
26
|
+
'Use the curried overload of `produce`: `produce(recipe)` instead of `(state) => produce(state, recipe)`.',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
create: (context) => {
|
|
30
|
+
const sourceCode = context.sourceCode;
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
ArrowFunctionExpression: (
|
|
34
|
+
node: DeepReadonly<TSESTree.ArrowFunctionExpression>,
|
|
35
|
+
) => {
|
|
36
|
+
if (node.params.length !== 1) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const param = node.params[0];
|
|
41
|
+
|
|
42
|
+
if (
|
|
43
|
+
param === undefined ||
|
|
44
|
+
param.type !== AST_NODE_TYPES.Identifier ||
|
|
45
|
+
param.name.length === 0
|
|
46
|
+
) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const { name: parameterName } = param;
|
|
51
|
+
|
|
52
|
+
const callExpression = node.body;
|
|
53
|
+
|
|
54
|
+
if (!isProduceCall(callExpression)) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const [baseArgument, ...restArguments] = callExpression.arguments;
|
|
59
|
+
|
|
60
|
+
if (
|
|
61
|
+
baseArgument === undefined ||
|
|
62
|
+
restArguments.length === 0 ||
|
|
63
|
+
!isSameIdentifier(baseArgument, parameterName)
|
|
64
|
+
) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (hasOtherReferences(context, parameterName, baseArgument)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
report(context, {
|
|
73
|
+
arrowFunction: node,
|
|
74
|
+
callExpression,
|
|
75
|
+
remainingArguments: restArguments,
|
|
76
|
+
sourceCode,
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
defaultOptions: [],
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
type ReportContext = Readonly<{
|
|
85
|
+
arrowFunction: DeepReadonly<TSESTree.ArrowFunctionExpression>;
|
|
86
|
+
callExpression: DeepReadonly<TSESTree.CallExpression>;
|
|
87
|
+
remainingArguments: readonly DeepReadonly<TSESTree.CallExpressionArgument>[];
|
|
88
|
+
sourceCode: Readonly<{
|
|
89
|
+
getText: TSESLint.SourceCode['getText'];
|
|
90
|
+
}>;
|
|
91
|
+
}>;
|
|
92
|
+
|
|
93
|
+
const report = (
|
|
94
|
+
context: DeepReadonly<TSESLint.RuleContext<MessageIds, readonly []>>,
|
|
95
|
+
{
|
|
96
|
+
arrowFunction,
|
|
97
|
+
callExpression,
|
|
98
|
+
remainingArguments,
|
|
99
|
+
sourceCode,
|
|
100
|
+
}: ReportContext,
|
|
101
|
+
): void => {
|
|
102
|
+
const calleeText = sourceCode.getText(castDeepMutable(callExpression.callee));
|
|
103
|
+
|
|
104
|
+
const typeParametersText = getTypeParametersText({
|
|
105
|
+
arrowFunction,
|
|
106
|
+
callExpression,
|
|
107
|
+
sourceCode,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const remainingArgumentsText = remainingArguments
|
|
111
|
+
.map((argument) =>
|
|
112
|
+
normalizeMultilineText(sourceCode.getText(castDeepMutable(argument))),
|
|
113
|
+
)
|
|
114
|
+
.join(', ');
|
|
115
|
+
|
|
116
|
+
const replacement = `${calleeText}${typeParametersText}(${remainingArgumentsText})`;
|
|
117
|
+
|
|
118
|
+
context.report({
|
|
119
|
+
node: castDeepMutable(arrowFunction),
|
|
120
|
+
messageId: 'useCurriedProduce',
|
|
121
|
+
fix: (fixer) =>
|
|
122
|
+
fixer.replaceText(castDeepMutable(arrowFunction), replacement),
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const isProduceCall = (
|
|
127
|
+
node: DeepReadonly<TSESTree.Node>,
|
|
128
|
+
): node is TSESTree.CallExpression => {
|
|
129
|
+
if (node.type !== AST_NODE_TYPES.CallExpression) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
node.callee.type === AST_NODE_TYPES.Identifier &&
|
|
135
|
+
node.callee.name === 'produce'
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const isSameIdentifier = (
|
|
140
|
+
node: DeepReadonly<TSESTree.CallExpressionArgument>,
|
|
141
|
+
expectedName: string,
|
|
142
|
+
): node is TSESTree.Identifier =>
|
|
143
|
+
node.type === AST_NODE_TYPES.Identifier && node.name === expectedName;
|
|
144
|
+
|
|
145
|
+
const hasOtherReferences = (
|
|
146
|
+
context: DeepReadonly<TSESLint.RuleContext<MessageIds, readonly []>>,
|
|
147
|
+
parameterName: string,
|
|
148
|
+
baseIdentifier: DeepReadonly<TSESTree.Identifier>,
|
|
149
|
+
): boolean => {
|
|
150
|
+
const scope = context.sourceCode.getScope(castDeepMutable(baseIdentifier));
|
|
151
|
+
|
|
152
|
+
const variable = scope.variables.find(
|
|
153
|
+
(variableItem) => variableItem.name === parameterName,
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
if (variable === undefined) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return variable.references.some(
|
|
161
|
+
(reference) => reference.identifier !== baseIdentifier,
|
|
162
|
+
);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const getTypeArguments = (
|
|
166
|
+
node: DeepReadonly<TSESTree.CallExpression>,
|
|
167
|
+
): TSESTree.TSTypeParameterInstantiation | undefined => {
|
|
168
|
+
const mutableNode = castDeepMutable(node);
|
|
169
|
+
|
|
170
|
+
if (isRecord(mutableNode) && hasKey(mutableNode, 'typeArguments')) {
|
|
171
|
+
return (
|
|
172
|
+
mutableNode as TSESTree.CallExpression & {
|
|
173
|
+
typeArguments?: TSESTree.TSTypeParameterInstantiation;
|
|
174
|
+
}
|
|
175
|
+
).typeArguments;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (isRecord(mutableNode) && hasKey(mutableNode, 'typeParameters')) {
|
|
179
|
+
return (mutableNode as CallExpressionWithLegacyTypeParameters)
|
|
180
|
+
.typeParameters;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return undefined;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const getTypeParametersText = ({
|
|
187
|
+
arrowFunction,
|
|
188
|
+
callExpression,
|
|
189
|
+
sourceCode,
|
|
190
|
+
}: Readonly<{
|
|
191
|
+
arrowFunction: DeepReadonly<TSESTree.ArrowFunctionExpression>;
|
|
192
|
+
callExpression: DeepReadonly<TSESTree.CallExpression>;
|
|
193
|
+
sourceCode: Readonly<{
|
|
194
|
+
getText: TSESLint.SourceCode['getText'];
|
|
195
|
+
}>;
|
|
196
|
+
}>): string => {
|
|
197
|
+
const typeArguments = getTypeArguments(callExpression);
|
|
198
|
+
|
|
199
|
+
if (typeArguments !== undefined) {
|
|
200
|
+
return sourceCode.getText(castDeepMutable(typeArguments));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const parameterType = getArrowFunctionParameterType({
|
|
204
|
+
arrowFunction,
|
|
205
|
+
sourceCode,
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
if (parameterType !== undefined) {
|
|
209
|
+
return `<${parameterType}>`;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const returnType = getArrowFunctionReturnType({
|
|
213
|
+
arrowFunction,
|
|
214
|
+
sourceCode,
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
if (returnType !== undefined) {
|
|
218
|
+
return `<${returnType}>`;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return '';
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const getArrowFunctionParameterType = ({
|
|
225
|
+
arrowFunction,
|
|
226
|
+
sourceCode,
|
|
227
|
+
}: Readonly<{
|
|
228
|
+
arrowFunction: DeepReadonly<TSESTree.ArrowFunctionExpression>;
|
|
229
|
+
sourceCode: Readonly<{
|
|
230
|
+
getText: TSESLint.SourceCode['getText'];
|
|
231
|
+
}>;
|
|
232
|
+
}>): string | undefined => {
|
|
233
|
+
const [parameter] = arrowFunction.params;
|
|
234
|
+
|
|
235
|
+
if (parameter?.type !== AST_NODE_TYPES.Identifier) {
|
|
236
|
+
return undefined;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const typeAnnotation = parameter.typeAnnotation?.typeAnnotation;
|
|
240
|
+
|
|
241
|
+
if (typeAnnotation === undefined) {
|
|
242
|
+
return undefined;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return sourceCode.getText(castDeepMutable(typeAnnotation));
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const getArrowFunctionReturnType = ({
|
|
249
|
+
arrowFunction,
|
|
250
|
+
sourceCode,
|
|
251
|
+
}: Readonly<{
|
|
252
|
+
arrowFunction: DeepReadonly<TSESTree.ArrowFunctionExpression>;
|
|
253
|
+
sourceCode: Readonly<{
|
|
254
|
+
getText: TSESLint.SourceCode['getText'];
|
|
255
|
+
}>;
|
|
256
|
+
}>): string | undefined => {
|
|
257
|
+
const typeAnnotation = arrowFunction.returnType?.typeAnnotation;
|
|
258
|
+
|
|
259
|
+
if (typeAnnotation === undefined) {
|
|
260
|
+
return undefined;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return sourceCode.getText(castDeepMutable(typeAnnotation));
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const normalizeMultilineText = (text: string): string => {
|
|
267
|
+
const lines = text.split('\n');
|
|
268
|
+
|
|
269
|
+
if (lines.length <= 1) {
|
|
270
|
+
return text;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const indents = lines
|
|
274
|
+
.slice(1)
|
|
275
|
+
.filter((line) => line.trim().length > 0)
|
|
276
|
+
.map((line) => /^[\t ]*/u.exec(line)?.[0].length ?? 0);
|
|
277
|
+
|
|
278
|
+
if (indents.length === 0) {
|
|
279
|
+
return text;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const minIndent = Math.min(...indents);
|
|
283
|
+
|
|
284
|
+
if (minIndent === 0) {
|
|
285
|
+
return text;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const normalized = lines.map((line, index) =>
|
|
289
|
+
index === 0 ? line : line.slice(minIndent),
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
return normalized.join('\n');
|
|
293
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import parser from '@typescript-eslint/parser';
|
|
2
|
+
import { RuleTester } from '@typescript-eslint/rule-tester';
|
|
3
|
+
import dedent from 'dedent';
|
|
4
|
+
import { preferCurriedProduceRule } from './prefer-curried-produce.mjs';
|
|
5
|
+
|
|
6
|
+
const ruleName = 'prefer-curried-produce';
|
|
7
|
+
|
|
8
|
+
const tester = new RuleTester({
|
|
9
|
+
languageOptions: {
|
|
10
|
+
parser,
|
|
11
|
+
parserOptions: {
|
|
12
|
+
ecmaVersion: 2020,
|
|
13
|
+
sourceType: 'module',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe('prefer-curried-produce', () => {
|
|
19
|
+
tester.run(ruleName, preferCurriedProduceRule, {
|
|
20
|
+
valid: [
|
|
21
|
+
{
|
|
22
|
+
name: 'Already curried',
|
|
23
|
+
code: dedent`
|
|
24
|
+
import { produce } from 'immer';
|
|
25
|
+
|
|
26
|
+
const update = produce((draft) => {
|
|
27
|
+
draft.count += 1;
|
|
28
|
+
});
|
|
29
|
+
`,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'Already curried with type arg',
|
|
33
|
+
code: dedent`
|
|
34
|
+
import { produce } from 'immer';
|
|
35
|
+
|
|
36
|
+
const update = produce<State>((draft) => {
|
|
37
|
+
draft.count += 1;
|
|
38
|
+
});
|
|
39
|
+
`,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Multiple parameters are ignored',
|
|
43
|
+
code: dedent`
|
|
44
|
+
import { produce } from 'immer';
|
|
45
|
+
|
|
46
|
+
const update = (state, action) =>
|
|
47
|
+
produce(state, (draft) => {
|
|
48
|
+
draft.count += action.delta;
|
|
49
|
+
});
|
|
50
|
+
`,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'Base state differs from parameter',
|
|
54
|
+
code: dedent`
|
|
55
|
+
import { produce } from 'immer';
|
|
56
|
+
|
|
57
|
+
const update = (state) =>
|
|
58
|
+
produce(other, (draft) => {
|
|
59
|
+
draft.count += state.delta;
|
|
60
|
+
});
|
|
61
|
+
`,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'Parameter referenced inside recipe is ignored',
|
|
65
|
+
code: dedent`
|
|
66
|
+
import { produce } from 'immer';
|
|
67
|
+
|
|
68
|
+
const update = (state) =>
|
|
69
|
+
produce(state, (draft) => {
|
|
70
|
+
draft.count += state.delta;
|
|
71
|
+
});
|
|
72
|
+
`,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
invalid: [
|
|
76
|
+
{
|
|
77
|
+
name: 'Transforms simple updater',
|
|
78
|
+
code: dedent`
|
|
79
|
+
import { produce } from 'immer';
|
|
80
|
+
|
|
81
|
+
const update = (state) =>
|
|
82
|
+
produce(state, (draft) => {
|
|
83
|
+
draft.count += 1;
|
|
84
|
+
});
|
|
85
|
+
`,
|
|
86
|
+
output: dedent`
|
|
87
|
+
import { produce } from 'immer';
|
|
88
|
+
|
|
89
|
+
const update = produce((draft) => {
|
|
90
|
+
draft.count += 1;
|
|
91
|
+
});
|
|
92
|
+
`,
|
|
93
|
+
errors: [
|
|
94
|
+
{
|
|
95
|
+
messageId: 'useCurriedProduce',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'Transforms simple updater with type annotations',
|
|
101
|
+
code: dedent`
|
|
102
|
+
import { produce } from 'immer';
|
|
103
|
+
|
|
104
|
+
const update = (state: State): State =>
|
|
105
|
+
produce(state, (draft) => {
|
|
106
|
+
draft.count += 1;
|
|
107
|
+
});
|
|
108
|
+
`,
|
|
109
|
+
output: dedent`
|
|
110
|
+
import { produce } from 'immer';
|
|
111
|
+
|
|
112
|
+
const update = produce<State>((draft) => {
|
|
113
|
+
draft.count += 1;
|
|
114
|
+
});
|
|
115
|
+
`,
|
|
116
|
+
errors: [
|
|
117
|
+
{
|
|
118
|
+
messageId: 'useCurriedProduce',
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
});
|
|
124
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ESLintPlugin } from '../../../types/index.mjs';
|
|
2
|
+
import { preferCurriedProduceRule } from './prefer-curried-produce.mjs';
|
|
3
|
+
|
|
4
|
+
export const immerCodingStyleRules = {
|
|
5
|
+
'prefer-curried-produce': preferCurriedProduceRule,
|
|
6
|
+
} as const satisfies ESLintPlugin['rules'];
|
package/src/plugins/index.mts
CHANGED
package/src/rules/index.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './eslint-array-func-rules.mjs';
|
|
2
2
|
export * from './eslint-cypress-rules.mjs';
|
|
3
3
|
export * from './eslint-functional-rules.mjs';
|
|
4
|
+
export * from './eslint-immer-coding-style-rules.mjs';
|
|
4
5
|
export * from './eslint-import-rules.mjs';
|
|
5
6
|
export * from './eslint-jest-rules.mjs';
|
|
6
7
|
export * from './eslint-jsx-a11y-rules.mjs';
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
type EslintArrayFuncRules,
|
|
3
3
|
type EslintCypressRules,
|
|
4
4
|
type EslintFunctionalRules,
|
|
5
|
+
type EslintImmerCodingStyleRules,
|
|
5
6
|
type EslintImportsRules,
|
|
6
7
|
type EslintJestRules,
|
|
7
8
|
type EslintJsxA11yRules,
|
|
@@ -60,6 +61,7 @@ type KnownRules = DeepReadonly<
|
|
|
60
61
|
EslintUnicornRules &
|
|
61
62
|
EslintVitestRules &
|
|
62
63
|
EslintVitestCodingStyleRules &
|
|
64
|
+
EslintImmerCodingStyleRules &
|
|
63
65
|
EslintReactCodingStyleRules &
|
|
64
66
|
TypeScriptEslintRules
|
|
65
67
|
>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* cSpell:disable */
|
|
2
|
+
import { type Linter } from 'eslint';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Prefer the curried overload of immer produce for shorter updater definitions.
|
|
6
|
+
*
|
|
7
|
+
* ```md
|
|
8
|
+
* | key | value |
|
|
9
|
+
* | :--------- | :--------- |
|
|
10
|
+
* | type | suggestion |
|
|
11
|
+
* | deprecated | false |
|
|
12
|
+
* | fixable | code |
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
namespace PreferCurriedProduce {
|
|
16
|
+
export type RuleEntry = Linter.StringSeverity;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type EslintImmerCodingStyleRules = Readonly<{
|
|
20
|
+
'immer-coding-style/prefer-curried-produce': PreferCurriedProduce.RuleEntry;
|
|
21
|
+
}>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './eslint-array-func-rules.mjs';
|
|
2
2
|
export * from './eslint-cypress-rules.mjs';
|
|
3
3
|
export * from './eslint-functional-rules.mjs';
|
|
4
|
+
export * from './eslint-immer-coding-style-rules.mjs';
|
|
4
5
|
export * from './eslint-import-rules.mjs';
|
|
5
6
|
export * from './eslint-jest-rules.mjs';
|
|
6
7
|
export * from './eslint-jsx-a11y-rules.mjs';
|