ESLint configs for Guardian JavaScript and TypeScript projects.
npm install --save-dev @guardian/eslint-config
# or
yarn add --dev @guardian/eslint-config
# or
pnpm install --save-dev @guardian/eslint-config// eslint.config.js
import guardian from '@guardian/eslint-config';
export default [
...guardian.configs.recommended,
...guardian.configs.jest,
...guardian.configs.react,
...guardian.configs.storybook,
];The package's default export is an object with a configs property that provides configs for different projects.
Some of them are single-purpose, and others compose the single-purpose configs into useful presets.
Provides a recommended collection of useful configs covering both JavaScript and TypeScript.
Composes:
configs.javascriptconfigs.typescriptconfigs.importsconfigs.comments
Included in configs.recommended.
Provides a collection of configs for checking JavaScript, which are also applied to TypeScript files.
It automatically detects your project type (using package.json#type), and uses an appropriate config for each file.
Composes:
configs.esmconfigs.cjs
Included in configs.javascript.
Provides a collection of configs for ECMAScript modules.
It assumes everything will be ECMAScript, and will error if you use it on a CommonJS module.
Included in configs.javascript.
Provides a collection of configs for CommonJS modules.
It assumes everything will be CommonJS, and will error if you use it on an ECMAScript module.
Included in configs.recommended.
Provides a collection of configs for checking TypeScript.
Included in configs.recommended.
Provides a collection of configs ensuring best practice around module imports and exports.
Included in configs.recommended.
Provides a collection of configs ensuring best practice around code comments.
Provides a collection of configs for checking Jest units tests.
Provides a collection of configs for checking React components.
Provides a collection of configs for checking Storybook stories.
When using the storybook config, be sure to also have eslint-plugin-storybook and storybook installed in your project, otherwise the config will be ignored.