5.1.0 • Published 9 months ago

@arnaud-barre/eslint-config v5.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

eslint-config npm

Install

yarn add --dev eslint @arnaud-barre/eslint-config
// eslint.config.js
import baseConfig from "@arnaud-barre/eslint-config";

export default [...baseConfig];
// package.json
"scripts": {
  "lint": "bun lint-ci --fix --cache",
  "lint-ci": "eslint . --max-warnings 0"
}

TS config (5.5)

{
  "include": ["**/*.ts", "**/*.tsx"],
  "compilerOptions": {
    "target": "ES2021",
    "useDefineForClassFields": true,
    "jsx": "react-jsx",
    "module": "ESNext",
    "lib": ["ES2021", "DOM", "DOM.Iterable"],

    /* Bundler mode */
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "verbatimModuleSyntax": true,
    "noEmit": true,

    /* Linting */
    "skipLibCheck": true,
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true,
    "useUnknownInCatchVariables": true,
    "noPropertyAccessFromIndexSignature": true
  }
}

For Node projects

{
  "include": ["**/*.ts"],
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "lib": ["ES2022"]

    /* ... */
  }
}

Adding local rules

Here is an example for an hypothetical "no-while" rule (that could simply be achieved by using the no-restricted-syntax rule)

// eslint.config.js
import baseConfig from "@arnaud-barre/eslint-config";
import tseslint from "typescript-eslint";

/**
 * @type {import("@typescript-eslint/utils").TSESLint.RuleModule<"error">}
 */
const noWhileRule = {
  meta: {
    messages: { error: "Don't use while" },
    type: "problem",
    schema: [],
  },
  create: (context) => ({
    WhileStatement(node) {
      context.report({ node, messageId: "error" });
    },
  }),
};

export default tseslint.config(...baseConfig, {
  plugins: {
    local: {
      rules: {
        "no-while": noWhileRule,
      },
    },
  },
  rules: {
    "local/no-while": "warn",
  },
});
5.1.0

9 months ago

5.0.1

9 months ago

5.0.0

10 months ago

5.0.0-beta.2

10 months ago

5.0.0-beta.0

10 months ago

5.0.0-beta.1

10 months ago

4.1.1

1 year ago

4.1.0

1 year ago

4.0.2

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

3.1.5

2 years ago

3.1.4

2 years ago

2.1.0

2 years ago

3.1.3

2 years ago

3.1.2

2 years ago

3.0.3

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.19

2 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago