@effective/eslint-cfg
Version:
A library for generating ESLint Flat Configs with React and TypeScript support.
824 lines (823 loc) • 26.9 kB
JavaScript
import { createRequire } from "module";
const require = createRequire(import.meta.url);
export default [
{
settings: {
n: {
tryExtensions: [".js", ".ts", ".tsx"],
},
},
linterOptions: {
reportUnusedDisableDirectives: "off",
reportUnusedInlineConfigs: "off",
},
rules: {
"array-bracket-newline": "off",
"array-bracket-spacing": "off",
"array-element-newline": "off",
"arrow-parens": "off",
"arrow-spacing": "off",
"block-spacing": "off",
"brace-style": "off",
"comma-dangle": "off",
"comma-spacing": "off",
"comma-style": "off",
"computed-property-spacing": "off",
"constructor-super": "off",
curly: "off",
"default-case": "off",
"default-case-last": "off",
"dot-location": "off",
"eol-last": "off",
eqeqeq: "off",
"for-direction": "off",
"func-call-spacing": "off",
"function-call-argument-newline": "off",
"function-paren-newline": "off",
"generator-star": "off",
"generator-star-spacing": "off",
"getter-return": "off",
"guard-for-in": "off",
"implicit-arrow-linebreak": "off",
indent: "off",
"indent-legacy": "off",
"jsx-quotes": "off",
"key-spacing": "off",
"keyword-spacing": "off",
"linebreak-style": "off",
"lines-around-comment": "off",
"max-len": "off",
"max-statements-per-line": "off",
"multiline-ternary": "off",
"new-parens": "off",
"newline-per-chained-call": "off",
"no-array-constructor": "off",
"no-arrow-condition": "off",
"no-async-promise-executor": "off",
"no-case-declarations": "off",
"no-class-assign": "off",
"no-comma-dangle": "off",
"no-compare-neg-zero": "off",
"no-confusing-arrow": "off",
"no-console": "off",
"no-const-assign": "off",
"no-constant-condition": "off",
"no-constructor-return": "off",
"no-control-regex": "off",
"no-debugger": "off",
"no-dupe-args": "off",
"no-dupe-class-members": "off",
"no-dupe-else-if": "off",
"no-dupe-keys": "off",
"no-duplicate-case": "off",
"no-empty-character-class": "off",
"no-empty-pattern": "off",
"no-eval": "off",
"no-ex-assign": "off",
"no-extra-boolean-cast": "off",
"no-extra-label": "off",
"no-extra-parens": "off",
"no-extra-semi": "off",
"no-fallthrough": "off",
"no-floating-decimal": "off",
"no-func-assign": "off",
"no-global-assign": "off",
"no-implied-eval": "off",
"no-import-assign": "off",
"no-inner-declarations": "off",
"no-invalid-regexp": "off",
"no-irregular-whitespace": "off",
"no-label-var": "off",
"no-lone-blocks": "off",
"no-lonely-if": "off",
"no-misleading-character-class": "off",
"no-mixed-operators": "off",
"no-mixed-spaces-and-tabs": "off",
"no-multi-spaces": "off",
"no-multiple-empty-lines": "off",
"no-negated-condition": "off",
"no-nested-ternary": "off",
"no-new-native-nonconstructor": "off",
"no-new-symbol": "off",
"no-new-wrappers": "off",
"no-nonoctal-decimal-escape": "off",
"no-obj-calls": "off",
"no-octal-escape": "off",
"no-param-reassign": "off",
"no-prototype-builtins": "off",
"no-redeclare": "off",
"no-regex-spaces": "off",
"no-reserved-keys": "off",
"no-restricted-globals": "off",
"no-self-assign": "off",
"no-self-compare": "off",
"no-sequences": "off",
"no-setter-return": "off",
"no-shadow-restricted-names": "off",
"no-space-before-semi": "off",
"no-spaced-func": "off",
"no-sparse-arrays": "off",
"no-tabs": "off",
"no-template-curly-in-string": "off",
"no-this-before-super": "off",
"no-throw-literal": "off",
"no-trailing-spaces": "off",
"no-undef": "off",
"no-undef-init": "off",
"no-unexpected-multiline": "off",
"no-unneeded-ternary": "off",
"no-unreachable": "off",
"no-unsafe-finally": "off",
"no-unsafe-negation": "off",
"no-unsafe-optional-chaining": "off",
"no-unused-expressions": "off",
"no-unused-labels": "off",
"no-unused-private-class-members": "off",
"no-unused-vars": "off",
"no-useless-backreference": "off",
"no-useless-catch": "off",
"no-useless-concat": "off",
"no-useless-escape": "off",
"no-useless-rename": "off",
"no-var": "off",
"no-void": "off",
"no-whitespace-before-property": "off",
"no-with": "off",
"no-wrap-func": "off",
"nonblock-statement-body-position": "off",
"object-curly-newline": "off",
"object-curly-spacing": "off",
"object-property-newline": "off",
"one-var": "off",
"one-var-declaration-per-line": "off",
"operator-assignment": "off",
"operator-linebreak": "off",
"padded-blocks": "off",
"prefer-const": "off",
"prefer-exponentiation-operator": "off",
"prefer-numeric-literals": "off",
"prefer-promise-reject-errors": "off",
"prefer-regex-literals": "off",
"prefer-rest-params": "off",
"prefer-template": "off",
"quote-props": "off",
quotes: "off",
"require-await": "off",
"require-yield": "off",
"rest-spread-spacing": "off",
semi: "off",
"semi-spacing": "off",
"semi-style": "off",
"space-after-function-name": "off",
"space-after-keywords": "off",
"space-before-blocks": "off",
"space-before-function-paren": "off",
"space-before-function-parentheses": "off",
"space-before-keywords": "off",
"space-in-brackets": "off",
"space-in-parens": "off",
"space-infix-ops": "off",
"space-return-throw-case": "off",
"space-unary-ops": "off",
"space-unary-word-ops": "off",
"switch-colon-spacing": "off",
"template-curly-spacing": "off",
"template-tag-spacing": "off",
"use-isnan": "off",
"valid-typeof": "off",
"wrap-iife": "off",
"wrap-regex": "off",
"yield-star-spacing": "off",
yoda: "off",
"@typescript-eslint/adjacent-overload-signatures": "off",
"@typescript-eslint/array-type": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/block-spacing": "off",
"@typescript-eslint/brace-style": "off",
"@typescript-eslint/comma-dangle": "off",
"@typescript-eslint/comma-spacing": "off",
"@typescript-eslint/default-param-last": "off",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/func-call-spacing": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/key-spacing": "off",
"@typescript-eslint/keyword-spacing": "off",
"@typescript-eslint/lines-around-comment": "off",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/no-dupe-class-members": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extra-non-null-assertion": "off",
"@typescript-eslint/no-extra-parens": "off",
"@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-invalid-void-type": "off",
"@typescript-eslint/no-loss-of-precision": "off",
"@typescript-eslint/no-misused-new": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-redeclare": "off",
"@typescript-eslint/no-restricted-imports": "off",
"@typescript-eslint/no-restricted-types": "off",
"@typescript-eslint/no-unnecessary-type-constraint": "off",
"@typescript-eslint/no-unsafe-declaration-merging": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-useless-constructor": "off",
"@typescript-eslint/no-useless-empty-export": "off",
"@typescript-eslint/object-curly-spacing": "off",
"@typescript-eslint/prefer-as-const": "off",
"@typescript-eslint/prefer-enum-initializers": "off",
"@typescript-eslint/prefer-function-type": "off",
"@typescript-eslint/prefer-literal-enum-member": "off",
"@typescript-eslint/prefer-namespace-keyword": "off",
"@typescript-eslint/prefer-optional-chain": "off",
"@typescript-eslint/quotes": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/semi": "off",
"@typescript-eslint/space-before-blocks": "off",
"@typescript-eslint/space-before-function-paren": "off",
"@typescript-eslint/space-infix-ops": "off",
"@typescript-eslint/type-annotation-spacing": "off",
"import/no-commonjs": "off",
"import/no-default-export": "off",
"import/no-nodejs-modules": "off",
"jest/max-nested-describe": "off",
"jest/no-done-callback": "off",
"jsx-a11y/alt-text": "off",
"jsx-a11y/anchor-ambiguous-text": "off",
"jsx-a11y/anchor-has-content": "off",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/aria-activedescendant-has-tabindex": "off",
"jsx-a11y/aria-props": "off",
"jsx-a11y/aria-proptypes": "off",
"jsx-a11y/aria-role": "off",
"jsx-a11y/aria-unsupported-elements": "off",
"jsx-a11y/autocomplete-valid": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/control-has-associated-label": "off",
"jsx-a11y/heading-has-content": "off",
"jsx-a11y/html-has-lang": "off",
"jsx-a11y/iframe-has-title": "off",
"jsx-a11y/img-redundant-alt": "off",
"jsx-a11y/interactive-supports-focus": "off",
"jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/label-has-for": "off",
"jsx-a11y/lang": "off",
"jsx-a11y/media-has-caption": "off",
"jsx-a11y/mouse-events-have-key-events": "off",
"jsx-a11y/no-access-key": "off",
"jsx-a11y/no-aria-hidden-on-focusable": "off",
"jsx-a11y/no-autofocus": "off",
"jsx-a11y/no-distracting-elements": "off",
"jsx-a11y/no-interactive-element-to-noninteractive-role": "off",
"jsx-a11y/no-noninteractive-element-to-interactive-role": "off",
"jsx-a11y/no-noninteractive-tabindex": "off",
"jsx-a11y/no-redundant-roles": "off",
"jsx-a11y/no-static-element-interactions": "off",
"jsx-a11y/prefer-tag-over-role": "off",
"jsx-a11y/role-has-required-aria-props": "off",
"jsx-a11y/role-supports-aria-props": "off",
"jsx-a11y/scope": "off",
"jsx-a11y/tabindex-no-positive": "off",
"n/no-process-env": "off",
"no-barrel-files/avoid-namespace-import": "off",
"no-barrel-files/avoid-re-export-all": "off",
"react-hooks/exhaustive-deps": "off",
"react-hooks/rules-of-hooks": "off",
"react/button-has-type": "off",
"react/jsx-child-element-spacing": "off",
"react/jsx-closing-bracket-location": "off",
"react/jsx-closing-tag-location": "off",
"react/jsx-curly-newline": "off",
"react/jsx-curly-spacing": "off",
"react/jsx-equals-spacing": "off",
"react/jsx-first-prop-new-line": "off",
"react/jsx-fragments": "off",
"react/jsx-indent": "off",
"react/jsx-indent-props": "off",
"react/jsx-key": "off",
"react/jsx-max-props-per-line": "off",
"react/jsx-newline": "off",
"react/jsx-no-comment-textnodes": "off",
"react/jsx-no-duplicate-props": "off",
"react/jsx-no-target-blank": "off",
"react/jsx-no-useless-fragment": "off",
"react/jsx-one-expression-per-line": "off",
"react/jsx-props-no-multi-spaces": "off",
"react/jsx-space-before-closing": "off",
"react/jsx-tag-spacing": "off",
"react/jsx-uses-react": "off",
"react/jsx-wrap-multilines": "off",
"react/no-array-index-key": "off",
"react/no-children-prop": "off",
"react/no-danger": "off",
"react/no-danger-with-children": "off",
"react/no-unsafe": "off",
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"react/void-dom-elements-no-children": "off",
"sonarjs/cognitive-complexity": "off",
"sonarjs/prefer-while": "off",
"standard/array-bracket-even-spacing": "off",
"standard/computed-property-even-spacing": "off",
"standard/object-curly-even-spacing": "off",
"unicorn/empty-brace-spaces": "off",
"unicorn/error-message": "off",
"unicorn/explicit-length-check": "off",
"unicorn/no-array-for-each": "off",
"unicorn/no-document-cookie": "off",
"unicorn/no-for-loop": "off",
"unicorn/no-instanceof-array": "off",
"unicorn/no-lonely-if": "off",
"unicorn/no-nested-ternary": "off",
"unicorn/no-static-only-class": "off",
"unicorn/no-thenable": "off",
"unicorn/no-useless-switch-case": "off",
"unicorn/number-literal-case": "off",
"unicorn/prefer-array-flat-map": "off",
"unicorn/prefer-date-now": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/prefer-number-properties": "off",
"unicorn/prefer-string-slice": "off",
"unicorn/prefer-string-trim-start-end": "off",
"unicorn/require-number-to-fixed-digits-argument": "off",
"unicorn/template-indent": "off",
"unicorn/throw-new-error": "off",
"unused-imports/no-unused-imports": "off",
"unused-imports/no-unused-vars": "off",
},
plugins: {
"@typescript-eslint": require("@typescript-eslint/eslint-plugin"),
react: require("eslint-plugin-react"),
"react-hooks": require("eslint-plugin-react-hooks"),
"react-compiler": require("eslint-plugin-react-compiler"),
storybook: require("eslint-plugin-storybook"),
"jsx-a11y": require("eslint-plugin-jsx-a11y"),
jsdoc: require("eslint-plugin-jsdoc"),
regexp: require("eslint-plugin-regexp"),
n: require("eslint-plugin-n"),
},
languageOptions: {
sourceType: "module",
ecmaVersion: 2025,
parser: require("@typescript-eslint/parser"),
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: "latest",
projectService: true,
},
globals: {
__dirname: "off",
__filename: "off",
AbortController: false,
AbortSignal: false,
atob: false,
Blob: false,
BroadcastChannel: false,
btoa: false,
Buffer: false,
ByteLengthQueuingStrategy: false,
clearImmediate: false,
clearInterval: false,
clearTimeout: false,
CloseEvent: false,
CompressionStream: false,
console: false,
CountQueuingStrategy: false,
crypto: false,
Crypto: false,
CryptoKey: false,
CustomEvent: false,
DecompressionStream: false,
DOMException: false,
Event: false,
EventTarget: false,
exports: "off",
fetch: false,
File: false,
FormData: false,
global: false,
Headers: false,
MessageChannel: false,
MessageEvent: false,
MessagePort: false,
module: "off",
navigator: false,
Navigator: false,
performance: false,
Performance: false,
PerformanceEntry: false,
PerformanceMark: false,
PerformanceMeasure: false,
PerformanceObserver: false,
PerformanceObserverEntryList: false,
PerformanceResourceTiming: false,
process: false,
queueMicrotask: false,
ReadableByteStreamController: false,
ReadableStream: false,
ReadableStreamBYOBReader: false,
ReadableStreamBYOBRequest: false,
ReadableStreamDefaultController: false,
ReadableStreamDefaultReader: false,
Request: false,
require: "off",
Response: false,
setImmediate: false,
setInterval: false,
setTimeout: false,
structuredClone: false,
SubtleCrypto: false,
TextDecoder: false,
TextDecoderStream: false,
TextEncoder: false,
TextEncoderStream: false,
TransformStream: false,
TransformStreamDefaultController: false,
URL: false,
URLSearchParams: false,
WebAssembly: false,
WebSocket: false,
WritableStream: false,
WritableStreamDefaultController: false,
WritableStreamDefaultWriter: false,
AggregateError: false,
Array: false,
ArrayBuffer: false,
Atomics: false,
BigInt: false,
BigInt64Array: false,
BigUint64Array: false,
Boolean: false,
DataView: false,
Date: false,
decodeURI: false,
decodeURIComponent: false,
encodeURI: false,
encodeURIComponent: false,
Error: false,
escape: false,
eval: false,
EvalError: false,
FinalizationRegistry: false,
Float32Array: false,
Float64Array: false,
Function: false,
globalThis: false,
Infinity: false,
Int16Array: false,
Int32Array: false,
Int8Array: false,
Intl: false,
isFinite: false,
isNaN: false,
JSON: false,
Map: false,
Math: false,
NaN: false,
Number: false,
Object: false,
parseFloat: false,
parseInt: false,
Promise: false,
Proxy: false,
RangeError: false,
ReferenceError: false,
Reflect: false,
RegExp: false,
Set: false,
SharedArrayBuffer: false,
String: false,
Symbol: false,
SyntaxError: false,
TypeError: false,
Uint16Array: false,
Uint32Array: false,
Uint8Array: false,
Uint8ClampedArray: false,
undefined: false,
unescape: false,
URIError: false,
WeakMap: false,
WeakRef: false,
WeakSet: false,
},
},
name: "effective/base",
},
{
languageOptions: {
globals: {
afterAll: false,
afterEach: false,
beforeAll: false,
beforeEach: false,
describe: false,
expect: false,
fit: false,
it: false,
jest: false,
test: false,
xdescribe: false,
xit: false,
xtest: false,
__dirname: "off",
__filename: "off",
AbortController: false,
AbortSignal: false,
atob: false,
Blob: false,
BroadcastChannel: false,
btoa: false,
Buffer: false,
ByteLengthQueuingStrategy: false,
clearImmediate: false,
clearInterval: false,
clearTimeout: false,
CloseEvent: false,
CompressionStream: false,
console: false,
CountQueuingStrategy: false,
crypto: false,
Crypto: false,
CryptoKey: false,
CustomEvent: false,
DecompressionStream: false,
DOMException: false,
Event: false,
EventTarget: false,
exports: "off",
fetch: false,
File: false,
FormData: false,
global: false,
Headers: false,
MessageChannel: false,
MessageEvent: false,
MessagePort: false,
module: "off",
navigator: false,
Navigator: false,
performance: false,
Performance: false,
PerformanceEntry: false,
PerformanceMark: false,
PerformanceMeasure: false,
PerformanceObserver: false,
PerformanceObserverEntryList: false,
PerformanceResourceTiming: false,
process: false,
queueMicrotask: false,
ReadableByteStreamController: false,
ReadableStream: false,
ReadableStreamBYOBReader: false,
ReadableStreamBYOBRequest: false,
ReadableStreamDefaultController: false,
ReadableStreamDefaultReader: false,
Request: false,
require: "off",
Response: false,
setImmediate: false,
setInterval: false,
setTimeout: false,
structuredClone: false,
SubtleCrypto: false,
TextDecoder: false,
TextDecoderStream: false,
TextEncoder: false,
TextEncoderStream: false,
TransformStream: false,
TransformStreamDefaultController: false,
URL: false,
URLSearchParams: false,
WebAssembly: false,
WebSocket: false,
WritableStream: false,
WritableStreamDefaultController: false,
WritableStreamDefaultWriter: false,
AggregateError: false,
Array: false,
ArrayBuffer: false,
Atomics: false,
BigInt: false,
BigInt64Array: false,
BigUint64Array: false,
Boolean: false,
DataView: false,
Date: false,
decodeURI: false,
decodeURIComponent: false,
encodeURI: false,
encodeURIComponent: false,
Error: false,
escape: false,
eval: false,
EvalError: false,
FinalizationRegistry: false,
Float32Array: false,
Float64Array: false,
Function: false,
globalThis: false,
Infinity: false,
Int16Array: false,
Int32Array: false,
Int8Array: false,
Intl: false,
isFinite: false,
isNaN: false,
JSON: false,
Map: false,
Math: false,
NaN: false,
Number: false,
Object: false,
parseFloat: false,
parseInt: false,
Promise: false,
Proxy: false,
RangeError: false,
ReferenceError: false,
Reflect: false,
RegExp: false,
Set: false,
SharedArrayBuffer: false,
String: false,
Symbol: false,
SyntaxError: false,
TypeError: false,
Uint16Array: false,
Uint32Array: false,
Uint8Array: false,
Uint8ClampedArray: false,
undefined: false,
unescape: false,
URIError: false,
WeakMap: false,
WeakRef: false,
WeakSet: false,
},
},
plugins: {
jest: require("eslint-plugin-jest"),
"testing-library": require("eslint-plugin-testing-library"),
},
files: ["**/*.test.{ts,tsx}"],
name: "effective/test",
},
{
languageOptions: {
globals: {
AbortController: false,
AbortSignal: false,
atob: false,
Blob: false,
BroadcastChannel: false,
btoa: false,
ByteLengthQueuingStrategy: false,
clearInterval: false,
clearTimeout: false,
CompressionStream: false,
console: false,
CountQueuingStrategy: false,
crypto: false,
Crypto: false,
CryptoKey: false,
CustomEvent: false,
DecompressionStream: false,
DOMException: false,
Event: false,
EventTarget: false,
fetch: false,
File: false,
FormData: false,
Headers: false,
Intl: false,
MessageChannel: false,
MessageEvent: false,
MessagePort: false,
performance: false,
PerformanceEntry: false,
PerformanceMark: false,
PerformanceMeasure: false,
PerformanceObserver: false,
PerformanceObserverEntryList: false,
PerformanceResourceTiming: false,
queueMicrotask: false,
ReadableByteStreamController: false,
ReadableStream: false,
ReadableStreamBYOBReader: false,
ReadableStreamBYOBRequest: false,
ReadableStreamDefaultController: false,
ReadableStreamDefaultReader: false,
Request: false,
Response: false,
setInterval: false,
setTimeout: false,
structuredClone: false,
SubtleCrypto: false,
TextDecoder: false,
TextDecoderStream: false,
TextEncoder: false,
TextEncoderStream: false,
TransformStream: false,
TransformStreamDefaultController: false,
URL: false,
URLSearchParams: false,
WebAssembly: false,
WritableStream: false,
WritableStreamDefaultController: false,
WritableStreamDefaultWriter: false,
__dirname: "off",
__filename: "off",
Buffer: false,
clearImmediate: false,
CloseEvent: false,
exports: "off",
global: false,
module: "off",
navigator: false,
Navigator: false,
Performance: false,
process: false,
require: "off",
setImmediate: false,
WebSocket: false,
AggregateError: false,
Array: false,
ArrayBuffer: false,
Atomics: false,
BigInt: false,
BigInt64Array: false,
BigUint64Array: false,
Boolean: false,
DataView: false,
Date: false,
decodeURI: false,
decodeURIComponent: false,
encodeURI: false,
encodeURIComponent: false,
Error: false,
escape: false,
eval: false,
EvalError: false,
FinalizationRegistry: false,
Float32Array: false,
Float64Array: false,
Function: false,
globalThis: false,
Infinity: false,
Int16Array: false,
Int32Array: false,
Int8Array: false,
isFinite: false,
isNaN: false,
JSON: false,
Map: false,
Math: false,
NaN: false,
Number: false,
Object: false,
parseFloat: false,
parseInt: false,
Promise: false,
Proxy: false,
RangeError: false,
ReferenceError: false,
Reflect: false,
RegExp: false,
Set: false,
SharedArrayBuffer: false,
String: false,
Symbol: false,
SyntaxError: false,
TypeError: false,
Uint16Array: false,
Uint32Array: false,
Uint8Array: false,
Uint8ClampedArray: false,
undefined: false,
unescape: false,
URIError: false,
WeakMap: false,
WeakRef: false,
WeakSet: false,
},
},
plugins: {
playwright: require("eslint-plugin-playwright"),
},
files: ["**/*.spec.{ts}"],
name: "effective/e2e",
},
{
rules: {
"import/no-anonymous-default-export": "off",
},
files: ["**/*.stories.tsx"],
name: "effective/storybook",
},
];