@getresponse/eslint-config
v10.1.2
Published
GetResponse ESLint shareable config
Downloads
1,270
Readme
@getresponse/eslint-config
An opinionated ESLint ruleset targeting TypeScript + React/Vue web apps.
Requirements
- ESLint
^9.0.0 - Node
>=18.18
Installation
npm i -D eslint @getresponse/eslint-configUsage
Create eslint.config.js in your project root:
import config from '@getresponse/eslint-config';
export default config;With local overrides:
import { defineConfig } from 'eslint/config';
import config from '@getresponse/eslint-config';
export default defineConfig(
config,
{
files: ['src/legacy/**/*.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
);TypeScript project files
Rules requiring type information use parserOptions.project. The package picks the tsconfig in this order:
tsconfig.eslint.jsonin the project root (preferred), ortsconfig.json(fallback).
The picked tsconfig's include/exclude/files are honored as-is — every file matched by ESLint must also be covered by the tsconfig's include (and not by exclude), otherwise typescript-eslint will throw a parsing error.
If you have files outside src/ you want linted (config files, scripts, tests excluded from the build tsconfig, etc.), create a dedicated tsconfig.eslint.json:
{
"extends": "./tsconfig.json",
"include": [
"src/**/*",
"tests/**/*",
"scripts/**/*",
"*.config.ts",
"*.config.js"
],
"exclude": []
}Notes:
- If your build
tsconfig.jsonexcludes test files ("exclude": ["**/*.test.ts"]), override it with"exclude": []intsconfig.eslint.jsonso tests are linted. - All matched files share a single TypeScript Program — efficient for small/medium projects. For large monorepos with project references, consider switching to
projectServicevia a local override (see typescript-eslint docs). - You can override the picked tsconfig path globally via the
ESLINT_CUSTOM_TSCONFIG_PATHenv var.
Dynamic rules
Plugin rulesets are enabled automatically when the corresponding package is detected in your package.json:
typescriptreact(+react-hooks)vuejest@playwright/test/playwright
Presets
Every ruleset that ships with the package is also exposed via config.presets, so you can compose them explicitly (e.g. apply Vue rules in a project where vue isn't in package.json, or override ordering):
import { defineConfig } from 'eslint/config';
import config from '@getresponse/eslint-config';
export default defineConfig(config, config.presets.vue);Available entries on config.presets:
| Name | Description |
|---|---|
| bestPractices, errors, es6, style, variables | Core rule groups (always on in the default config) |
| typescript | TypeScript rules (auto-loaded when typescript is in package.json) |
| react | React + react-hooks (auto-loaded when react is in package.json) |
| vue | Vue 3 strongly-recommended (auto-loaded when vue is in package.json) |
| jest | Jest rules (auto-loaded when jest is in package.json) |
| playwright | Playwright rules (auto-loaded when @playwright/test / playwright is in package.json) |
| a11y | Accessibility rules via eslint-plugin-jsx-a11y (opt-in only) |
If the corresponding package is already in your package.json, the rules are loaded automatically — you only need config.presets.X for explicit composition or for a11y (which is never auto-loaded).
Mixins
Additional opt-in rulesets — equivalent to config.presets.a11y above, kept for backward compatibility:
import { defineConfig } from 'eslint/config';
import config from '@getresponse/eslint-config';
import a11y from '@getresponse/eslint-config/mixins/a11y';
export default defineConfig(config, a11y);| Mixin | Description |
|------------------------------------------|---|
| @getresponse/eslint-config/mixins/a11y | Accessibility rules via eslint-plugin-jsx-a11y |
Rules list
The web version of the rules list is available on GitHub Pages
