diff --git a/index.js b/index.js index c212ddc..97fe323 100644 --- a/index.js +++ b/index.js @@ -65,6 +65,7 @@ const config = { }, ], curly: ["error"], + "functional/prefer-immutable-types": "off", }, overrides: [ { @@ -77,10 +78,6 @@ const config = { "functional/no-expression-statements": "off", "functional/no-throw-statements": "off", "functional/no-conditional-statements": "off", - "functional/prefer-immutable-types": [ - "error", - { enforcement: "ReadonlyDeep" }, - ], }, }, { @@ -94,12 +91,6 @@ const config = { ], // This is a common pattern in React for hooks and callbacks. "functional/no-return-void": "off", - "functional/prefer-immutable-types": [ - "error", - { - ignoreTypePattern: ["JSX"], - }, - ], }, }, ], diff --git a/index.ts b/index.ts index dd85173..d9e4645 100644 --- a/index.ts +++ b/index.ts @@ -67,6 +67,7 @@ const config: TSESLint.Linter.Config = { }, ], curly: ["error"], + "functional/prefer-immutable-types": "off", }, overrides: [ { @@ -79,10 +80,6 @@ const config: TSESLint.Linter.Config = { "functional/no-expression-statements": "off", "functional/no-throw-statements": "off", "functional/no-conditional-statements": "off", - "functional/prefer-immutable-types": [ - "error", - { enforcement: "ReadonlyDeep" }, - ], }, }, { @@ -96,12 +93,6 @@ const config: TSESLint.Linter.Config = { ], // This is a common pattern in React for hooks and callbacks. "functional/no-return-void": "off", - "functional/prefer-immutable-types": [ - "error", - { - ignoreTypePattern: ["JSX"], - }, - ], }, }, ], diff --git a/test-fixtures/base-react.js b/test-fixtures/base-react.js index 96b4609..79bf45a 100644 --- a/test-fixtures/base-react.js +++ b/test-fixtures/base-react.js @@ -25,7 +25,7 @@ const Foo = () => { exports.Foo = Foo; // Note: no functional/functional-parameters error here // Note: Report functional immutable type error if JSX.Element return type is not explicitly specified. -// eslint-disable-next-line functional/prefer-immutable-types +// Note: functional/prefer-immutable-types should not be triggered (it is disabled until library issue is resolved) const Boo = () => { return (0, jsx_runtime_1.jsx)("div", {}); }; diff --git a/test-fixtures/base-react.tsx b/test-fixtures/base-react.tsx index da0af4d..c9bf738 100644 --- a/test-fixtures/base-react.tsx +++ b/test-fixtures/base-react.tsx @@ -24,7 +24,7 @@ export const Foo = (): JSX.Element => { // Note: no functional/functional-parameters error here // Note: Report functional immutable type error if JSX.Element return type is not explicitly specified. -// eslint-disable-next-line functional/prefer-immutable-types +// Note: functional/prefer-immutable-types should not be triggered (it is disabled until library issue is resolved) export const Boo = () => { return
; }; diff --git a/test-fixtures/base.js b/test-fixtures/base.js index 05b5b80..5dd3885 100644 --- a/test-fixtures/base.js +++ b/test-fixtures/base.js @@ -14,7 +14,7 @@ console.warn(""); // eslint-disable-next-line no-restricted-properties exports.a = JSON.stringify(""); // NB JSON.stringify is not detected when accessed via an alias. -// eslint-disable-next-line functional/prefer-immutable-types +// Note: functional/prefer-immutable-types should not be triggered (it is disabled until library issue is resolved) const JSONAlias = JSON; exports.b = JSONAlias.stringify(""); // Note: no-template-curly-in-string is on @@ -25,7 +25,7 @@ exports.whoops = "${whoops}"; const myFunction = () => ""; exports.myFunction = myFunction; // Note: report the expected functional parameters errors. -// eslint-disable-next-line functional/functional-parameters, functional/prefer-immutable-types, @typescript-eslint/no-unused-vars +// eslint-disable-next-line functional/functional-parameters, @typescript-eslint/no-unused-vars const myFunctionWithParam = (..._args) => { return ""; }; diff --git a/test-fixtures/base.ts b/test-fixtures/base.ts index 65ecd2b..caee959 100644 --- a/test-fixtures/base.ts +++ b/test-fixtures/base.ts @@ -13,7 +13,7 @@ console.warn(""); export const a = JSON.stringify(""); // NB JSON.stringify is not detected when accessed via an alias. -// eslint-disable-next-line functional/prefer-immutable-types +// Note: functional/prefer-immutable-types should not be triggered (it is disabled until library issue is resolved) const JSONAlias = JSON; export const b = JSONAlias.stringify(""); @@ -26,7 +26,7 @@ export const whoops = "${whoops}"; export const myFunction = (): string => ""; // Note: report the expected functional parameters errors. -// eslint-disable-next-line functional/functional-parameters, functional/prefer-immutable-types, @typescript-eslint/no-unused-vars +// eslint-disable-next-line functional/functional-parameters, @typescript-eslint/no-unused-vars export const myFunctionWithParam = (..._args: string[]): string => { return ""; }; diff --git a/yarn.lock b/yarn.lock index 60ee77f..c101301 100644 --- a/yarn.lock +++ b/yarn.lock @@ -835,14 +835,6 @@ "@typescript-eslint/types" "6.17.0" "@typescript-eslint/visitor-keys" "6.17.0" -"@typescript-eslint/scope-manager@6.7.3": - version "6.7.3" - resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.3.tgz" - integrity sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ== - dependencies: - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/visitor-keys" "6.7.3" - "@typescript-eslint/type-utils@5.62.0", "@typescript-eslint/type-utils@^5.55.0", "@typescript-eslint/type-utils@^5.62.0": version "5.62.0" resolved "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz" @@ -853,7 +845,7 @@ debug "^4.3.4" tsutils "^3.21.0" -"@typescript-eslint/type-utils@6.17.0": +"@typescript-eslint/type-utils@6.17.0", "@typescript-eslint/type-utils@^6.0.0": version "6.17.0" resolved "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.17.0.tgz" integrity sha512-hDXcWmnbtn4P2B37ka3nil3yi3VCQO2QEB9gBiHJmQp5wmyQWqnjA85+ZcE8c4FqnaB6lBwMrPkgd4aBYz3iNg== @@ -863,16 +855,6 @@ debug "^4.3.4" ts-api-utils "^1.0.1" -"@typescript-eslint/type-utils@^6.0.0": - version "6.7.3" - resolved "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.3.tgz" - integrity sha512-Fc68K0aTDrKIBvLnKTZ5Pf3MXK495YErrbHb1R6aTpfK5OdSFj0rVN7ib6Tx6ePrZ2gsjLqr0s98NG7l96KSQw== - dependencies: - "@typescript-eslint/typescript-estree" "6.7.3" - "@typescript-eslint/utils" "6.7.3" - debug "^4.3.4" - ts-api-utils "^1.0.1" - "@typescript-eslint/types@5.62.0": version "5.62.0" resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz" @@ -883,11 +865,6 @@ resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.17.0.tgz" integrity sha512-qRKs9tvc3a4RBcL/9PXtKSehI/q8wuU9xYJxe97WFxnzH8NWWtcW3ffNS+EWg8uPvIerhjsEZ+rHtDqOCiH57A== -"@typescript-eslint/types@6.7.3": - version "6.7.3" - resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.3.tgz" - integrity sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw== - "@typescript-eslint/typescript-estree@5.62.0": version "5.62.0" resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz" @@ -915,19 +892,6 @@ semver "^7.5.4" ts-api-utils "^1.0.1" -"@typescript-eslint/typescript-estree@6.7.3": - version "6.7.3" - resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.3.tgz" - integrity sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g== - dependencies: - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/visitor-keys" "6.7.3" - debug "^4.3.4" - globby "^11.1.0" - is-glob "^4.0.3" - semver "^7.5.4" - ts-api-utils "^1.0.1" - "@typescript-eslint/utils@5.62.0", "@typescript-eslint/utils@^5.10.0", "@typescript-eslint/utils@^5.62.0": version "5.62.0" resolved "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.62.0.tgz" @@ -942,7 +906,7 @@ eslint-scope "^5.1.1" semver "^7.3.7" -"@typescript-eslint/utils@6.17.0": +"@typescript-eslint/utils@6.17.0", "@typescript-eslint/utils@^6.2.0": version "6.17.0" resolved "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.17.0.tgz" integrity sha512-LofsSPjN/ITNkzV47hxas2JCsNCEnGhVvocfyOcLzT9c/tSZE7SfhS/iWtzP1lKNOEfLhRTZz6xqI8N2RzweSQ== @@ -955,19 +919,6 @@ "@typescript-eslint/typescript-estree" "6.17.0" semver "^7.5.4" -"@typescript-eslint/utils@6.7.3", "@typescript-eslint/utils@^6.2.0": - version "6.7.3" - resolved "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.3.tgz" - integrity sha512-vzLkVder21GpWRrmSR9JxGZ5+ibIUSudXlW52qeKpzUEQhRSmyZiVDDj3crAth7+5tmN1ulvgKaCU2f/bPRCzg== - dependencies: - "@eslint-community/eslint-utils" "^4.4.0" - "@types/json-schema" "^7.0.12" - "@types/semver" "^7.5.0" - "@typescript-eslint/scope-manager" "6.7.3" - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/typescript-estree" "6.7.3" - semver "^7.5.4" - "@typescript-eslint/visitor-keys@5.62.0": version "5.62.0" resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz" @@ -984,14 +935,6 @@ "@typescript-eslint/types" "6.17.0" eslint-visitor-keys "^3.4.1" -"@typescript-eslint/visitor-keys@6.7.3": - version "6.7.3" - resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.3.tgz" - integrity sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg== - dependencies: - "@typescript-eslint/types" "6.7.3" - eslint-visitor-keys "^3.4.1" - "@ungap/structured-clone@^1.2.0": version "1.2.0" resolved "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz" @@ -3150,16 +3093,11 @@ minimist@1, minimist@^1.2.0, minimist@^1.2.6: resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== -ms@2.1.2: +ms@2.1.2, ms@^2.1.1: version "2.1.2" resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@^2.1.1: - version "2.1.3" - resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - natural-compare-lite@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz"