ESLint config used as the base for all Inrupt projects. You'll likely want to import eslint-config-inrupt-lib or eslint-config-inrupt-react.
In order to use these ESLint configurations, you will need to add the following
line to the top of your project's .eslintrc.js
file:
require("@rushstack/eslint-patch/modern-module-resolution");
This ensures that you load the dependencies from the ESLint configuration, instead of your project. This patch is a workaround for the long-standing ESLint issue 3458 regarding how ESLint loads modules.
Use this configuration to load all the TypeScript-specific rules - it builds on
top of @inrupt/eslint-config-base
.
Use this configuration for React projects or packages, it too builds on top of
@inrupt/eslint-config-base
.
If you're working on a TypeScript project or package, you'll need additional configuration to get TypeScript working:
parserOptions: {
project: "./tsconfig.eslint.json",
},
// These settings and the `plugin:import/typescript` are required until we add
// this configuration to our @inrupt/eslint-config-lib base
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
typescript: {
alwaysTryTypes: true,
project: "./tsconfig.eslint.json",
},
},
},
rules: {
"react/jsx-filename-extension": [
"error",
{
extensions: [".tsx"],
},
],
},
Our general principles are as follows:
- Use airbnb-base.
- Load recommended configs for common libraries: e.g., eslint, jest, typescript.
- Load Prettier config to override everything where there are conflicts.
- Enforce licensing headers.
- Configure common problems (no-shadow, no-unresolved, etc).
- Load React-specific configs for React projects.
- Do very little else - i.e., as few custom rules or overrides as possible.