Shared ESLint config for MinDoktor projects
Recommended settings for Mindoktor projects.
yarn add -D @mindoktor/eslint-config@mindoktor/eslint-config \
@eslint/js \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser \
eslint \
eslint-config-prettier \
eslint-import-resolver-typescript \
eslint-plugin-import \
eslint-plugin-prettier \
eslint-plugin-simple-import-sort \
eslint-plugin-unused-imports \
prettier \
typescript \
typescript-eslinteslint.config.mjs
// @ts-check
import { configs } from '@mindoktor/eslint-config';
import { globalIgnores, defineConfig } from 'eslint/config';
const defaultConfig = defineConfig(
{
extends: [configs.stylistic, configs.recommended],
languageOptions: {
parserOptions: {
projectService: true,
},
},
settings: {
'import/resolver': {
typescript: {
project: './tsconfig.json',
},
},
},
},
{
// Overrides
rules: {
// ...
},
},
globalIgnores(['node_modules/']),
);
export default defaultConfig;Includes recommended settings for React projects as well as the other recommended settings.
In addition to the above command, you should also install the following dependencies:
yarn add -D eslint-plugin-react eslint-plugin-react-hookseslint.config.mjs
// @ts-check
import { configs } from '@mindoktor/eslint-config';
import { globalIgnores, defineConfig } from 'eslint/config';
const defaultConfig = defineConfig(
{
extends: [configs.stylistic, configs.reactRecommended],
languageOptions: {
parserOptions: {
projectService: true,
},
},
settings: {
'import/resolver': {
typescript: {
project: './tsconfig.json',
},
},
react: {
version: 'detect',
},
},
},
{
// Overrides
rules: {
// ...
},
},
globalIgnores(['node_modules/']),
);
export default defaultConfig;To install a specific branch of the ESLint config, you can use the following command:
yarn add -D @mindoktor/eslint-config@mindoktor/eslint-config#<branch-name>Replace <branch-name> with the name of the branch you want to install.
If the branch name is a semantic version (e.g., 1.0.0), the package manager will use semver rules.
See more: https://docs.npmjs.com/cli/v8/configuring-npm/package-json#github-urls