eslint-config-current-thing
Version:
Lint The Current Thing
1,579 lines (1,494 loc) • 227 kB
JavaScript
// PathMark: ./src/config.js
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable sonarjs/cognitive-complexity */
/*
This file is fully generated, to edit it change ./generate-config.ts
Generated on 2/11/2025
*/
import antfuConfig from "@antfu/eslint-config";
import babelPlugin from "@babel/eslint-plugin";
import eslint from "@eslint/js";
import markdown from "@eslint/markdown";
import comments from "@eslint-community/eslint-plugin-eslint-comments";
import {
configs as graphqlConfigs,
parseForESLint as graphQLparseForESLint,
processors as graphqlProcessors,
rules as graphQLRules,
} from "@graphql-eslint/eslint-plugin";
import msdl from "@microsoft/eslint-plugin-sdl";
import nextjs from "@next/eslint-plugin-next";
import rnPlugin from "@react-native/eslint-plugin";
import stylistic from "@stylistic/eslint-plugin";
import tanstack from "@tanstack/eslint-plugin-query";
import vitest from "@vitest/eslint-plugin";
import restrictedGlobals from "confusing-browser-globals";
import standardTS from "eslint-config-love";
import prettierConfig from "eslint-config-prettier";
import xo from "eslint-config-xo";
import { defineFlatConfig } from "eslint-define-config";
import * as eslintMdx from "eslint-mdx";
import antfu from "eslint-plugin-antfu";
import ava from "eslint-plugin-ava";
import ban from "eslint-plugin-ban";
import boundaries from "eslint-plugin-boundaries";
import chaiFriendly from "eslint-plugin-chai-friendly";
import checkFile from "eslint-plugin-check-file";
import command from "eslint-plugin-command";
import compat from "eslint-plugin-compat";
import cssModules from "eslint-plugin-css-modules";
import cypress from "eslint-plugin-cypress";
import depend from "eslint-plugin-depend";
import esX from "eslint-plugin-es-x";
import formatJs from "eslint-plugin-formatjs";
import functional from "eslint-plugin-functional";
import header from "eslint-plugin-header";
import html from "eslint-plugin-html";
import i18next from "eslint-plugin-i18next";
import importPlugin from "eslint-plugin-import";
import importX from "eslint-plugin-import-x";
import jasmine from "eslint-plugin-jasmine";
import jest from "eslint-plugin-jest";
import jestDom from "eslint-plugin-jest-dom";
import jestFormatting from "eslint-plugin-jest-formatting";
import jsdoc from "eslint-plugin-jsdoc";
import jsonc from "eslint-plugin-jsonc";
import jsxA11y from "eslint-plugin-jsx-a11y";
import * as mdx from "eslint-plugin-mdx";
import mocha from "eslint-plugin-mocha";
import nNode from "eslint-plugin-n";
import noJQuery from "eslint-plugin-no-jquery";
import noOnlyTest from "eslint-plugin-no-only-tests";
import noRelativeImport from "eslint-plugin-no-relative-import-paths";
import unsanitized from "eslint-plugin-no-unsanitized";
import noUseExtendNative from "eslint-plugin-no-use-extend-native";
import perfectionist from "eslint-plugin-perfectionist";
import playwright from "eslint-plugin-playwright";
import preferArrow from "eslint-plugin-prefer-arrow";
import prettier from "eslint-plugin-prettier";
import promise from "eslint-plugin-promise";
import react from "eslint-plugin-react";
import reactCompiler from "eslint-plugin-react-compiler";
import reactDebug from "eslint-plugin-react-debug";
import reactDom from "eslint-plugin-react-dom";
import reactHooks from "eslint-plugin-react-hooks";
import reactHooksExtra from "eslint-plugin-react-hooks-extra";
import reactNamingConvention from "eslint-plugin-react-naming-convention";
import reactNativeIndie from "eslint-plugin-react-native";
import reactPerf from "eslint-plugin-react-perf";
import preferFC from "eslint-plugin-react-prefer-function-component";
import reactRefresh from "eslint-plugin-react-refresh";
import reactWebAPI from "eslint-plugin-react-web-api";
import reactX from "eslint-plugin-react-x";
import regexp from "eslint-plugin-regexp";
import security from "eslint-plugin-security";
import importSort from "eslint-plugin-simple-import-sort";
import sonarjs from "eslint-plugin-sonarjs";
import sortClassMembers from "eslint-plugin-sort-class-members";
import sortDestructure from "eslint-plugin-sort-destructure-keys";
import storybook from "eslint-plugin-storybook";
import tailwindcss from "eslint-plugin-tailwindcss";
import testingLibrary from "eslint-plugin-testing-library";
import toml from "eslint-plugin-toml";
import tsdoc from "eslint-plugin-tsdoc";
import turbo from "eslint-plugin-turbo";
import unicorn from "eslint-plugin-unicorn";
import unusedImports from "eslint-plugin-unused-imports";
import { configs as wdio, rules as wdioPlugin } from "eslint-plugin-wdio";
import yml from "eslint-plugin-yml";
import youDontNeedLodash from "eslint-plugin-you-dont-need-lodash-underscore";
import * as espree from "espree";
import globals from "globals";
import gts from "gts";
import jsoncEslintParser from "jsonc-eslint-parser";
import tomlEslintParser from "toml-eslint-parser";
import tseslint from "typescript-eslint";
import ymlEslintParser from "yaml-eslint-parser";
const antfuConfigRaw = await antfuConfig({
lessOpinionated: true,
// formatters: {
// css: true,
// html: true,
// markdown: "prettier",
// },
react: true,
}).renamePlugins({
import: "import-x",
node: "n",
react: "react-x",
style: "@stylistic",
test: "vitest",
ts: "@typescript-eslint",
yaml: "yml",
});
const jsxFiles = ["**/*.jsx"];
const tsxFiles = ["**/*.tsx"];
const jsFiles = ["**/*.js", ...jsxFiles, "**/*.mjs", "**/*.cjs"];
const tsFiles = ["**/*.ts", ...tsxFiles, "**/*.mts", "**/*.cts"];
const files = [...jsFiles, ...tsFiles];
const jsonFiles = [
"*.json",
"**/*.json",
"*.json5",
"**/*.json5",
"*.jsonc",
"**/*.jsonc",
];
const ymlFiles = ["**/*.yaml", "**/*.yml"];
const codeBlocks = ["**/*.md/**", "**/*.mdx/**"];
const mdFiles = ["**/*.mdx", "**/*.md"];
const tomlFiles = ["**/*.toml"];
const graphQLFiles = ["**/*.graphql"];
const TEST_PATTERNS = [
"**/*.test",
"**/*_test",
"**/*Test",
"**/*.spec",
"**/*_spec",
"**/*Spec",
"**/__{mocks,tests}__/**/*",
];
/**
* Combines an array of file patterns with an array of extensions
* @param {string[]} patterns - Array of glob patterns without extensions
* @param {string[]} extensions - Array of file extensions without the dot (e.g. ['js', 'jsx'])
* @returns {string[]} Array of complete glob patterns with extensions
*/
const addExtensions = (patterns, extensions) =>
patterns.flatMap((p) => extensions.map((extension) => `${p}.${extension}`));
const tsTestFiles = addExtensions(TEST_PATTERNS, ["ts", "tsx"]);
const jsTestFiles = addExtensions(TEST_PATTERNS, ["js", "jsx"]);
const defaultOptions = { disable: [], override: {}, threshold: 531_417 };
/**
* @param {{ disable: string[], override: Record<string, Record<string, number | string>>, threshold: number }} default - Options
* @returns { import("eslint-define-config").FlatESLintConfig[] } an ESLint Flat Config list
*/
const configGen = ({
disable = [],
override = {},
threshold = 531_417,
} = defaultOptions) =>
// @ts-expect-error type mismatching here is expected because the return is defined as a literal type, on literal types.
defineFlatConfig([
{
ignores: [
"**/eslint.config.js",
"dist",
"build",
"artifacts",
"coverage",
".git",
"node_modules",
"index.js",
],
},
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},
/* PROCESSORS */
{
files: mdFiles,
processor: markdown.processors.markdown,
},
{
files: mdFiles,
processor: mdx.processors.remark,
},
{
files,
processor: graphqlProcessors.graphql,
},
/* PARSERS */
/*
MDX
1,165,350 monthly downloads
ESLint Parser for MDX
https://github.com/mdx-js/eslint-mdx/blob/master/packages/eslint-mdx
*/
{
files: mdFiles,
languageOptions: {
ecmaVersion: "latest",
globals: {
React: false,
},
parser: eslintMdx,
sourceType: "module",
},
},
/*
TOML
1,537,331 monthly downloads
A TOML parser that produces output compatible with ESLint
https://github.com/ota-meshi/toml-eslint-parser#readme
*/
{
files: tomlFiles,
languageOptions: {
parser: tomlEslintParser,
},
},
/*
GraphQL
2,163,821 monthly downloads
GraphQL plugin for ESLint
https://github.com/dimaMachina/graphql-eslint#readme
*/
{
files: graphQLFiles,
languageOptions: {
parser: graphQLparseForESLint,
},
},
/*
YML
3,905,995 monthly downloads
A YAML parser that produces output compatible with ESLint
https://github.com/ota-meshi/yaml-eslint-parser#readme
*/
{
files: ymlFiles,
languageOptions: {
parser: ymlEslintParser,
},
},
/*
JSONC
8,834,014 monthly downloads
JSON, JSONC and JSON5 parser for use with ESLint plugins
https://github.com/ota-meshi/jsonc-eslint-parser#readme
*/
{
files: jsonFiles,
languageOptions: {
parser: jsoncEslintParser,
},
},
/*
TypeScript
174,947,126 monthly downloads
Tooling which enables you to use TypeScript with ESLint / An ESLint custom parser which leverages TypeScript ESTree
https://typescript-eslint.io/packages/typescript-eslint / https://typescript-eslint.io/packages/parser
*/
{
files: tsFiles,
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaVersion: "latest",
project: true,
warnOnUnsupportedTypeScriptVersion: false,
},
},
},
/*
Espree
189,326,429 monthly downloads
An Esprima-compatible JavaScript parser built on Acorn
https://github.com/eslint/js/blob/main/packages/espree/README.md
*/
{
files: jsFiles,
languageOptions: {
parser: espree,
},
},
/* PLUGINS */
{
plugins: {
"@babel": babelPlugin,
"@graphql-eslint": { rules: graphQLRules },
"@microsoft/sdl": msdl,
"@next/next": nextjs,
"@react-native": rnPlugin,
"@stylistic": stylistic,
"@tanstack": tanstack,
"@typescript-eslint": tseslint.plugin,
antfu,
ava,
ban,
boundaries,
"chai-friendly": chaiFriendly,
"check-file": checkFile,
command,
compat,
"css-modules": cssModules,
cypress,
depend,
"es-x": esX,
"eslint-comments": comments,
formatjs: formatJs,
functional,
header,
html,
i18next,
import: importPlugin,
"import-x": importX,
jasmine,
jest,
"jest-dom": jestDom,
"jest-formatting": jestFormatting,
jsdoc,
jsonc,
"jsx-a11y": jsxA11y,
markdown,
mdx,
mocha,
n: nNode,
"no-jquery": noJQuery,
"no-only-tests": noOnlyTest,
"no-relative-import-paths": noRelativeImport,
"no-unsanitized": unsanitized,
"no-use-extend-native": noUseExtendNative,
perfectionist,
playwright,
"prefer-arrow": preferArrow,
prettier,
"prettier-package-json": prettier,
"prettier-tailwind": prettier,
promise,
react,
"react-compiler": reactCompiler,
"react-debug": reactDebug,
"react-dom": reactDom,
"react-hooks": reactHooks,
"react-hooks-extra": reactHooksExtra,
"react-naming-convention": reactNamingConvention,
"react-native": reactNativeIndie,
"react-perf": reactPerf,
"react-prefer-function-component": preferFC,
"react-refresh": reactRefresh,
"react-web-api": reactWebAPI,
"react-x": reactX,
regexp,
security,
"simple-import-sort": importSort,
sonarjs,
"sort-class-members": sortClassMembers,
"sort-destructure-keys": sortDestructure,
storybook,
tailwindcss,
"testing-library": testingLibrary,
toml,
tsdoc,
turbo,
unicorn,
"unused-imports": unusedImports,
vitest,
wdio: { rules: wdioPlugin },
yml,
"you-dont-need-lodash-underscore": youDontNeedLodash,
},
},
/* CONFIGS */
/*
React Prefer Function Component
310,675 monthly downloads
ESLint plugin that prevents the use of JSX class components
https://github.com/tatethurston/eslint-plugin-react-prefer-function-component#readme
Requires: react-prefer-function-component
*/
...(disable.includes("eslint-plugin-react-prefer-function-component") ||
threshold > 310_675
? []
: [
{
files: [...jsxFiles, ...tsxFiles],
name: "React Prefer Function Component",
rules: {
...preferFC.configs.recommended.rules,
...("eslint-plugin-react-prefer-function-component" in override
? override["eslint-plugin-react-prefer-function-component"]
: {}),
},
},
]),
/*
Microsoft SDL
325,524 monthly downloads
ESLint plugin focused on common security issues and misconfigurations discoverable during static testing as part of Microsoft Security Development Lifecycle (SDL)
https://github.com/microsoft/eslint-plugin-sdl
Requires: @microsoft/sdl
*/
...(disable.includes("@microsoft/eslint-plugin-sdl") || threshold > 325_524
? []
: [
{
files,
name: "Microsoft SDL",
rules: {
// "Recommended" is just a smattering of everything: If Angular ever becomes a thing then we should add the angular modules here.
...msdl.configs.common.rules,
...("@microsoft/eslint-plugin-sdl" in override
? override["@microsoft/eslint-plugin-sdl"]
: {}),
},
},
]),
/*
Microsoft SDL - Node
325,524 monthly downloads
ESLint plugin focused on common security issues and misconfigurations discoverable during static testing as part of Microsoft Security Development Lifecycle (SDL)
https://github.com/microsoft/eslint-plugin-sdl
Requires: n, @microsoft/sdl
*/
...(disable.includes("@microsoft/eslint-plugin-sdl/node") ||
threshold > 325_524
? []
: [
{
files,
name: "Microsoft SDL/node",
rules: {
// "Recommended" is just a smattering of everything
...msdl.configs.node.rules,
...("@microsoft/eslint-plugin-sdl/node" in override
? override["@microsoft/eslint-plugin-sdl/node"]
: {}),
},
},
]),
/*
Microsoft SDL - React
325,524 monthly downloads
ESLint plugin focused on common security issues and misconfigurations discoverable during static testing as part of Microsoft Security Development Lifecycle (SDL)
https://github.com/microsoft/eslint-plugin-sdl
Requires: react, @microsoft/sdl
*/
...(disable.includes("@microsoft/eslint-plugin-sdl/react") ||
threshold > 325_524
? []
: [
{
files: [...jsxFiles, ...tsxFiles],
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
name: "Microsoft SDL/react",
rules: {
// "Recommended" is just a smattering of everything
...msdl.configs.react.rules,
...("@microsoft/eslint-plugin-sdl/react" in override
? override["@microsoft/eslint-plugin-sdl/react"]
: {}),
},
},
]),
/*
Microsoft SDL - TS
325,524 monthly downloads
ESLint plugin focused on common security issues and misconfigurations discoverable during static testing as part of Microsoft Security Development Lifecycle (SDL)
https://github.com/microsoft/eslint-plugin-sdl
Requires: @typescript-eslint, @microsoft/sdl
*/
...(disable.includes("@microsoft/eslint-plugin-sdl/ts") ||
threshold > 325_524
? []
: [
{
files: tsFiles,
name: "Microsoft SDL/ts",
rules: {
// "Recommended" is just a smattering of everything
...msdl.configs.typescript.rules,
...("@microsoft/eslint-plugin-sdl/ts" in override
? override["@microsoft/eslint-plugin-sdl/ts"]
: {}),
},
},
]),
/*
Standard React
428,158 monthly downloads
JavaScript Standard Style React/JSX support - ESLint Shareable Config
https://github.com/standard/eslint-config-standard-react
Requires: react, react-hooks
*/
...(disable.includes("eslint-config-standard-react") || threshold > 428_158
? []
: [
{
files: [...jsxFiles, ...tsxFiles],
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
name: "Standard React",
rules: {
"functional/functional-parameters": 0,
"functional/no-classes": 0,
"functional/no-conditional-statements": 0,
"functional/no-expression-statements": 0,
"functional/no-return-void": 0,
"functional/no-throw-statements": 0,
"react-hooks/exhaustive-deps": 1,
"react-hooks/rules-of-hooks": 2,
"react/jsx-no-bind": [
2,
{
allowArrowFunctions: true,
allowBind: false,
ignoreRefs: true,
},
],
"react/no-did-update-set-state": 2,
"react/no-unknown-property": 2,
"react/no-unused-prop-types": 2,
"react/prop-types": 2,
"react/react-in-jsx-scope": 2,
...("eslint-config-standard-react" in override
? override["eslint-config-standard-react"]
: {}),
},
settings: {
react: {
version: "detect",
},
},
},
]),
/*
CSS Modules
478,729 monthly downloads
Checks that you are using the existent css/scss/less classes, no more no less
undefined
Requires: css-modules
*/
...(disable.includes("eslint-plugin-css-modules") || threshold > 478_729
? []
: [
{
files: [...jsxFiles, ...tsxFiles],
name: "CSS Modules",
rules: {
...cssModules.configs.recommended.rules,
...("eslint-plugin-css-modules" in override
? override["eslint-plugin-css-modules"]
: {}),
},
},
]),
/*
Boundaries
479,388 monthly downloads
Eslint plugin checking architecture boundaries between elements
https://github.com/javierbrea/eslint-plugin-boundaries#readme
Requires: boundaries
*/
...(disable.includes("eslint-plugin-boundaries") || threshold > 479_388
? []
: [
{
files,
name: "Boundaries",
rules: {
...boundaries.configs.recommended.rules,
...("eslint-plugin-boundaries" in override
? override["eslint-plugin-boundaries"]
: {}),
},
},
]),
/*
No JQuery
492,049 monthly downloads
Disallow jQuery functions with native equivalents.
https://github.com/wikimedia/eslint-plugin-no-jquery#readme
Requires: no-jquery
*/
...(disable.includes("eslint-plugin-no-jquery") || threshold > 492_049
? []
: [
{
files,
name: "No JQuery",
rules: {
"no-jquery/variable-pattern": "error",
...("eslint-plugin-no-jquery" in override
? override["eslint-plugin-no-jquery"]
: {}),
},
},
]),
/*
Ava
542,412 monthly downloads
ESLint rules for AVA
https://github.com/avajs/eslint-plugin-ava#readme
Requires: ava
*/
...(disable.includes("eslint-plugin-ava") || threshold > 542_412
? []
: [
{
files: jsTestFiles,
name: "Ava",
rules: {
...ava.configs.recommended.rules,
...("eslint-plugin-ava" in override
? override["eslint-plugin-ava"]
: {}),
},
},
]),
/*
No Use Extend Native
542,412 monthly downloads
ESLint rules for AVA
https://github.com/avajs/eslint-plugin-ava#readme
Requires: no-use-extend-native
*/
...(disable.includes("eslint-plugin-ava") || threshold > 542_412
? []
: [
{
files,
name: "No Use Extend Native",
rules: {
...noUseExtendNative.configs.recommended.rules,
...("eslint-plugin-ava" in override
? override["eslint-plugin-ava"]
: {}),
},
},
]),
/*
Webdriver IO
567,567 monthly downloads
Eslint rules for WebdriverIO
https://github.com/webdriverio/webdriverio/tree/main/packages/eslint-plugin-wdio
Requires: wdio
*/
...(disable.includes("eslint-plugin-wdio") || threshold > 567_567
? []
: [
{
files,
languageOptions: {
globals: wdio["flat/recommended"].languageOptions.globals,
},
name: "Webdriver IO",
rules: {
...wdio["flat/recommended"].rules,
...("eslint-plugin-wdio" in override
? override["eslint-plugin-wdio"]
: {}),
},
},
]),
/*
React Performance
588,887 monthly downloads
Performance-minded React linting rules for ESLint
https://github.com/cvazac/eslint-plugin-react-perf#readme
Requires: react-perf
*/
...(disable.includes("eslint-plugin-react-perf") || threshold > 588_887
? []
: [
{
files: [...jsxFiles, ...tsxFiles],
name: "React Performance",
rules: {
...reactPerf.configs.recommended.rules,
"functional/functional-parameters": 0,
"functional/no-classes": 0,
"functional/no-conditional-statements": 0,
"functional/no-expression-statements": 0,
"functional/no-return-void": 0,
"functional/no-throw-statements": 0,
...("eslint-plugin-react-perf" in override
? override["eslint-plugin-react-perf"]
: {}),
},
},
]),
/*
Depend
605,678 monthly downloads
An ESLint plugin to suggest optimized dependencies, native alternatives and more
https://github.com/es-tooling/eslint-plugin-depend#readme
Requires: depend
*/
...(disable.includes("eslint-plugin-depend") || threshold > 605_678
? []
: [
{
files,
name: "Depend",
rules: {
"depend/ban-dependencies": [
2,
{
// Allowing these because they are not deprecated / abandoned
allowed: ["eslint-plugin-import", "eslint-plugin-react"],
},
],
...("eslint-plugin-depend" in override
? override["eslint-plugin-depend"]
: {}),
},
},
]),
/*
TOML
621,485 monthly downloads
This ESLint plugin provides linting rules for TOML.
https://ota-meshi.github.io/eslint-plugin-toml/
Requires: toml
*/
...(disable.includes("eslint-plugin-toml") || threshold > 621_485
? []
: [
{
files: tomlFiles,
name: "TOML",
rules: {
...toml.configs.base.overrides[0].rules,
...toml.configs.recommended.rules,
...toml.configs.standard.rules,
...("eslint-plugin-toml" in override
? override["eslint-plugin-toml"]
: {}),
},
},
]),
/*
Antfu
679,584 monthly downloads
Anthony's ESLint config
https://github.com/antfu/eslint-config
Requires: antfu, command, @typescript-eslint, n, import-x, yml, @stylistic, vitest, no-only-tests, jsdoc, jsonc, perfectionist, regexp, toml, unicorn, unused-imports, eslint-comments, react-dom, react-hooks, react-hooks-extra, react-naming-convention, react-refresh, react-web-api, react-x
*/
...(disable.includes("@antfu/eslint-config") || threshold > 679_584
? []
: [
...antfuConfigRaw.map(({ plugins: _plugins, ...config }) => {
// Change the test name space
if (config.name === "antfu/test/rules") {
return {
...config,
rules: {
...config.rules,
"no-only-tests/no-only-tests":
config.rules?.["vitest/no-only-tests"] ?? 0,
"vitest/no-only-tests": 0,
},
};
}
// Change the ecma version for JS files to allow 'with' imports
if (config.name === "antfu/javascript/setup") {
return {
...config,
languageOptions: {
...config.languageOptions,
ecmaVersion: "latest",
parserOptions: {
...config.languageOptions?.parserOptions,
ecmaVersion: "latest",
},
},
};
}
// Because these configs do not have files defined, they will attempt to lint things like .md files that should not be linted as js files
const ruleConfigs = [
"antfu/javascript/rules",
"antfu/eslint-comments/rules",
"antfu/command/rules",
"antfu/perfectionist/setup",
"antfu/stylistic/rules",
"antfu/regexp/rules",
"antfu/jsdoc/rules",
];
if (config.name && ruleConfigs.includes(config.name)) {
return {
...config,
files,
};
}
return config;
}),
{
files,
name: "Antfu",
rules: {
"arrow-parens": 0,
"block-spacing": 0,
"brace-style": 0,
"comma-dangle": 0,
indent: 0,
"object-curly-spacing": 0,
"operator-linebreak": 0,
"prettier-tailwind/prettier": 0,
"prettier/prettier": 0,
"quote-props": 0,
semi: 0,
"space-before-function-paren": 0,
...("@antfu/eslint-config" in override
? override["@antfu/eslint-config"]
: {}),
},
},
]),
/*
React Web API
706,991 monthly downloads
ESLint React's ESLint plugin for interacting with Web APIs
https://github.com/Rel1cx/eslint-react
Requires: react-web-api
*/
...(disable.includes("eslint-plugin-react-web-api") || threshold > 706_991
? []
: [
{
files: tsFiles,
name: "React Web API",
rules: {
"react-web-api/no-leaked-event-listener": "warn",
"react-web-api/no-leaked-interval": "warn",
"react-web-api/no-leaked-resize-observer": "warn",
"react-web-api/no-leaked-timeout": "warn",
...("eslint-plugin-react-web-api" in override
? override["eslint-plugin-react-web-api"]
: {}),
},
},
]),
/*
React Debug
711,819 monthly downloads
ESLint React's ESLint plugin for debugging related rules.
https://github.com/Rel1cx/eslint-react
Requires: react-debug
*/
...(disable.includes("eslint-plugin-react-debug") || threshold > 711_819
? []
: [
{
files: tsFiles,
name: "React Debug",
rules: {
"react-debug/class-component": "warn",
"react-debug/function-component": "warn",
"react-debug/hook": "warn",
"react-debug/is-from-react": "off",
...("eslint-plugin-react-debug" in override
? override["eslint-plugin-react-debug"]
: {}),
},
},
]),
/*
Functional
712,213 monthly downloads
ESLint rules to promote functional programming in TypeScript.
https://github.com/eslint-functional/eslint-plugin-functional#readme
Requires: functional
*/
...(disable.includes("eslint-plugin-functional") || threshold > 712_213
? []
: [
{
files: jsFiles,
name: "Functional",
rules: {
...functional.configs.externalVanillaRecommended.rules,
...functional.configs.recommended.rules,
...functional.configs.disableTypeChecked.rules,
...("eslint-plugin-functional" in override
? override["eslint-plugin-functional"]
: {}),
},
},
]),
/*
Functional - Stylistic
712,213 monthly downloads
ESLint rules to promote functional programming in TypeScript.
https://github.com/eslint-functional/eslint-plugin-functional#readme
Requires: functional
*/
...(disable.includes("eslint-plugin-functional/stylistic") ||
threshold > 712_213
? []
: [
{
files,
name: "Functional/stylistic",
rules: {
...functional.configs.stylistic.rules,
...("eslint-plugin-functional/stylistic" in override
? override["eslint-plugin-functional/stylistic"]
: {}),
},
},
]),
/*
Functional - TS
712,213 monthly downloads
ESLint rules to promote functional programming in TypeScript.
https://github.com/eslint-functional/eslint-plugin-functional#readme
Requires: @typescript-eslint, functional
*/
...(disable.includes("eslint-plugin-functional/ts") || threshold > 712_213
? []
: [
{
files: tsFiles,
name: "Functional/ts",
rules: {
...functional.configs.recommended.rules,
...functional.configs.externalTypeScriptRecommended.rules,
...("eslint-plugin-functional/ts" in override
? override["eslint-plugin-functional/ts"]
: {}),
},
},
]),
/*
React Naming Convention
714,528 monthly downloads
ESLint React's ESLint plugin for naming convention related rules.
https://github.com/Rel1cx/eslint-react
Requires: react-naming-convention
*/
...(disable.includes("eslint-plugin-react-naming-convention") ||
threshold > 714_528
? []
: [
{
files: tsFiles,
name: "React Naming Convention",
rules: {
"react-naming-convention/filename-extension": [
"warn",
"as-needed",
],
"react-naming-convention/use-state": "warn",
...("eslint-plugin-react-naming-convention" in override
? override["eslint-plugin-react-naming-convention"]
: {}),
},
},
]),
/*
React DOM
715,240 monthly downloads
ESLint React's ESLint plugin for React DOM related rules.
https://github.com/Rel1cx/eslint-react
Requires: react-dom
*/
...(disable.includes("eslint-plugin-react-dom") || threshold > 715_240
? []
: [
{
files: tsFiles,
name: "React DOM",
rules: {
"react-dom/no-dangerously-set-innerhtml": "warn",
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
"react-dom/no-find-dom-node": "error",
"react-dom/no-missing-button-type": "warn",
"react-dom/no-missing-iframe-sandbox": "warn",
"react-dom/no-namespace": "error",
"react-dom/no-render-return-value": "error",
"react-dom/no-script-url": "warn",
"react-dom/no-unknown-property": "warn",
"react-dom/no-unsafe-iframe-sandbox": "warn",
"react-dom/no-unsafe-target-blank": "warn",
"react-dom/no-void-elements-with-children": "warn",
...("eslint-plugin-react-dom" in override
? override["eslint-plugin-react-dom"]
: {}),
},
},
]),
/*
React X
717,349 monthly downloads
A set of composable linting rules for libraries and frameworks that use React as a UI runtime.
https://github.com/Rel1cx/eslint-react
Requires: react-x
*/
...(disable.includes("eslint-plugin-react-x") || threshold > 717_349
? []
: [
{
files: tsFiles,
name: "React X",
rules: {
"react-x/ensure-forward-ref-using-ref": "warn",
"react-x/no-access-state-in-setstate": "error",
"react-x/no-array-index-key": "warn",
"react-x/no-children-count": "warn",
"react-x/no-children-for-each": "warn",
"react-x/no-children-map": "warn",
"react-x/no-children-only": "warn",
"react-x/no-children-to-array": "warn",
"react-x/no-clone-element": "warn",
"react-x/no-comment-textnodes": "warn",
"react-x/no-component-will-mount": "error",
"react-x/no-component-will-receive-props": "error",
"react-x/no-component-will-update": "error",
"react-x/no-context-provider": "warn",
"react-x/no-create-ref": "error",
"react-x/no-default-props": "error",
"react-x/no-direct-mutation-state": "error",
"react-x/no-duplicate-jsx-props": "warn",
"react-x/no-duplicate-key": "error",
"react-x/no-forward-ref": "warn",
"react-x/no-implicit-key": "warn",
"react-x/no-missing-key": "error",
"react-x/no-nested-components": "error",
"react-x/no-prop-types": "error",
"react-x/no-redundant-should-component-update": "error",
"react-x/no-set-state-in-component-did-mount": "warn",
"react-x/no-set-state-in-component-did-update": "warn",
"react-x/no-set-state-in-component-will-update": "warn",
"react-x/no-string-refs": "error",
"react-x/no-unsafe-component-will-mount": "warn",
"react-x/no-unsafe-component-will-receive-props": "warn",
"react-x/no-unsafe-component-will-update": "warn",
"react-x/no-unstable-context-value": "warn",
"react-x/no-unstable-default-props": "warn",
"react-x/no-unused-class-component-members": "warn",
"react-x/no-unused-state": "warn",
"react-x/no-use-context": "warn",
"react-x/use-jsx-vars": "warn",
...("eslint-plugin-react-x" in override
? override["eslint-plugin-react-x"]
: {}),
},
},
]),
/*
Sort Destructure Keys
752,243 monthly downloads
require object destructure key to be sorted
https://github.com/mthadley/eslint-plugin-sort-destructure-keys#readme
Requires: sort-destructure-keys
*/
...(disable.includes("eslint-plugin-sort-destructure-keys") ||
threshold > 752_243
? []
: [
{
files,
name: "Sort Destructure Keys",
rules: {
"sort-destructure-keys/sort-destructure-keys": [
"error",
{
caseSensitive: false,
},
],
...("eslint-plugin-sort-destructure-keys" in override
? override["eslint-plugin-sort-destructure-keys"]
: {}),
},
},
]),
/*
You Don't Need Lodash
767,861 monthly downloads
Check methods you can use natively without lodash/underscore
https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore.git
Requires: you-dont-need-lodash-underscore
*/
...(disable.includes("eslint-plugin-you-dont-need-lodash-underscore") ||
threshold > 767_861
? []
: [
{
files,
name: "You Don't Need Lodash",
rules: {
...youDontNeedLodash.configs.compatible.rules,
...("eslint-plugin-you-dont-need-lodash-underscore" in override
? override["eslint-plugin-you-dont-need-lodash-underscore"]
: {}),
},
},
]),
/*
React Hooks Extra
773,317 monthly downloads
ESLint React's ESLint plugin for React Hooks related rules.
https://github.com/Rel1cx/eslint-react
Requires: react-hooks-extra
*/
...(disable.includes("eslint-plugin-react-hooks-extra") ||
threshold > 773_317
? []
: [
{
files: tsFiles,
name: "React Hooks Extra",
rules: {
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
"react-hooks-extra/no-useless-custom-hooks": "warn",
"react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
...("eslint-plugin-react-hooks-extra" in override
? override["eslint-plugin-react-hooks-extra"]
: {}),
},
},
]),
/*
Jasmine
829,106 monthly downloads
ESLint rules for Jasmine
https://github.com/tlvince/eslint-plugin-jasmine
Requires: jasmine
*/
...(disable.includes("eslint-plugin-jasmine") || threshold > 829_106
? []
: [
{
files: jsTestFiles,
languageOptions: {
globals: {
jasmine: true,
},
},
name: "Jasmine",
rules: {
...jasmine.configs.recommended.rules,
...("eslint-plugin-jasmine" in override
? override["eslint-plugin-jasmine"]
: {}),
},
},
]),
/*
Internationalization (i18n)
854,837 monthly downloads
ESLint plugin for i18n
https://github.com/edvardchen/eslint-plugin-i18next#readme
Requires: i18next
*/
...(disable.includes("eslint-plugin-i18next") || threshold > 854_837
? []
: [
{
files: [...jsxFiles, ...tsxFiles],
name: "Internationalization (i18n)",
rules: {
...i18next.configs.recommended.rules,
...("eslint-plugin-i18next" in override
? override["eslint-plugin-i18next"]
: {}),
},
},
]),
/*
FormatJS
876,276 monthly downloads
ESLint plugin for formatjs
https://github.com/formatjs/formatjs#readme
Requires: formatjs
*/
...(disable.includes("eslint-plugin-formatjs") || threshold > 876_276
? []
: [
{
files,
name: "FormatJS",
rules: {
...formatJs.configs.recommended.rules,
...("eslint-plugin-formatjs" in override
? override["eslint-plugin-formatjs"]
: {}),
},
},
]),
/*
Sort Class Members
941,795 monthly downloads
ESLint rule for enforcing consistent ES6 class member order.
https://github.com/bryanrsmith/eslint-plugin-sort-class-members
Requires: sort-class-members
*/
...(disable.includes("eslint-plugin-sort-class-members") ||
threshold > 941_795
? []
: [
{
files,
name: "Sort Class Members",
rules: {
...sortClassMembers.configs["flat/recommended"].rules,
...("eslint-plugin-sort-class-members" in override
? override["eslint-plugin-sort-class-members"]
: {}),
},
},
]),
/*
Google Typescript Style
1,093,811 monthly downloads
Google TypeScript Style
https://github.com/google/gts#readme
Requires: n, prettier
*/
...(disable.includes("gts") || threshold > 1_093_811
? []
: [
{
files: jsFiles,
name: "Google Typescript Style",
rules: {
"@stylistic/arrow-parens": 0,
"@stylistic/brace-style": 0,
"@stylistic/indent": 0,
"@stylistic/indent-binary-ops": 0,
"@stylistic/operator-linebreak": 0,
"@stylistic/quote-props": 0,
"@stylistic/quotes": 0,
"@stylistic/semi": 0,
"@stylistic/yield-star-spacing": 0,
"comma-dangle": 0,
"generator-star-spacing": 0,
indent: 0,
semi: 0,
"space-before-function-paren": 0,
"unicorn/no-nested-ternary": 0,
"yield-star-spacing": 0,
...gts.rules,
...("gts" in override ? override.gts : {}),
},
},
]),
/*
Google Typescript Style - TS
1,093,811 monthly downloads
Google TypeScript Style
https://github.com/google/gts#readme
Requires: n, @typescript-eslint
*/
...(disable.includes("gts/ts") || threshold > 1_093_811
? []
: [
{
files: tsFiles,
name: "Google Typescript Style/ts",
rules: {
...gts.overrides[0].rules,
...("gts/ts" in override ? override["gts/ts"] : {}),
},
},
]),
/*
XO
1,125,583 monthly downloads
ESLint shareable config for XO
https://github.com/xojs/eslint-config-xo#readme
Requires: (None)
*/
...(disable.includes("eslint-config-xo") || threshold > 1_125_583
? []
: [
{
files: jsFiles,
name: "XO",
rules: {
...xo.rules,
"mocha/no-mocha-arrows": 0,
...("eslint-config-xo" in override
? override["eslint-config-xo"]
: {}),
},
},
]),
/*
MDX - Code-Blocks
1,151,049 monthly downloads
ESLint Plugin for MDX
https://github.com/mdx-js/eslint-mdx/blob/master/packages/eslint-plugin-mdx
Requires: (None)
*/
...(disable.includes("eslint-plugin-mdx/code-blocks") ||
threshold > 1_151_049
? []
: [
{
files: codeBlocks,
languageOptions: {
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
},
},
},
name: "MDX/code-blocks",
rules: {
// MDX "recommended" is composed of Overrides, Base, and CodeBlocks but with unneeded conditional logic
// CodeBlocks:
...mdx.configs.codeBlocks.rules,
...("eslint-plugin-mdx/code-blocks" in override
? override["eslint-plugin-mdx/code-blocks"]
: {}),
},
},
]),
/*
No Relative Import Paths
1,227,034 monthly downloads
Moving a file to different folder, could result in changing all imports statement in that file. This will not happen is the import paths are absolute. The eslint rule helps enforcing having absolute import paths. Support eslint --fix to automatically chan
https://github.com/MelvinVermeer/eslint-plugin-no-relative-import-paths#readme
Requires: no-relative-import-paths
*/
...(disable.includes("eslint-plugin-no-relative-import-paths") ||
threshold > 1_227_034
? []
: [
{
files,
name: "No Relative Import Paths",
rules: {
"no-relative-import-paths/no-relative-import-paths": [
"warn",
{
allowedDepth: 2,
allowSameFolder: true,
},
],
...("eslint-plugin-no-relative-import-paths" in override
? override["eslint-plugin-no-relative-import-paths"]
: {}),
},
},
]),
/*
No Unsanitized
1,256,665 monthly downloads
ESLint rule to disallow unsanitized code
https://github.com/mozilla/eslint-plugin-no-unsanitized/
Requires: no-unsanitized
*/
...(disable.includes("eslint-plugin-no-unsanitized") ||
threshold > 1_256_665
? []
: [
{
files,
name: "No Unsanitized",
rules: {
...unsanitized.configs.recommended.rules,
...("eslint-plugin-no-unsanitized" in override
? override["eslint-plugin-no-unsanitized"]
: {}),
},
},
]),
/*
Chai Friendly
1,399,290 monthly downloads
This plugin makes 'no-unused-expressions' rule friendly towards chai expect statements.
https://github.com/ihordiachenko/eslint-plugin-chai-friendly#readme
Requires: chai-friendly
*/
...(disable.includes("eslint-plugin-chai-friendly") || threshold > 1_399_290
? []
: [
{
files: jsTestFiles,
name: "Chai Friendly",
rules: {
...chaiFriendly.configs.recommended.rules,
...("eslint-plugin-chai-friendly" in override
? override["eslint-plugin-chai-friendly"]
: {}),
},
},
]),
/*
React Compiler
1,552,837 monthly downloads
ESLint plugin to display errors found by the React compiler.
https://github.com/facebook/react#readme
Requires: react-compiler
*/
...(disable.includes("eslint-plugin-react-compiler") ||
threshold > 1_552_837
? []
: [
{
files: [...jsxFiles, ...tsxFiles],
name: "React Compiler",
rules: {
...reactCompiler.configs.recommended.rules,
...("eslint-plugin-react-compiler" in override
? override["eslint-plugin-react-compiler"]
: {}),
},
},
]),
/*
Google
1,582,058 monthly downloads
ESLint shareable config for the Google style
https://github.com/google/eslint-config-google#readme
Requires: jsdoc
*/
...(disable.includes("eslint-config-google") || threshold > 1_582_058
? []
: [
{
files: jsFiles,
name: "Google",
rules: {
"@stylistic/arrow-parens": 0,
"@stylistic/block-spacing": 0,
"@stylistic/brace-style": 0,
"@stylistic/indent": 0,
"@stylistic/object-curly-spacing": 0,
"@stylistic/operator-linebreak": 0,
"@stylistic/semi": 0,
"array-bracket-newline": 0,
"array-bracket-spacing": [2, "never"],
"array-element-newline": 0,
"arrow-parens": [2, "always"],
"block-spacing": [2, "never"],
"brace-style": 2,
camelcase: [2, { properties: "never" }],
"comma-dangle": [2, "always-multiline"],
"comma-spacing": 2,
"comma-style": 2,
"computed-property-spacing": 2,
"constructor-super": 2,
curly: [2, "multi-line"],
"eol-last": 2,
"func-call-spacing": 2,
"generator-star-spacing": [2, "after"],
"guard-for-in": 2,
indent: [
2,
2,
{
CallExpression: {
arguments: 2,
},
FunctionDeclaration: {
body: 1,
parameters: 2,
},
FunctionExpression: {
body: 1,
parameters: 2,
},
ignoredNodes: ["ConditionalExpression"],
MemberExpression: 2,
ObjectExpression: