Generic base configuration for ESLint supporting setups using TypeScript and React.
The following configurations are available and can be extended in a project-specific ESLint configuration. Note that it's possible to mix and match configurations.
@kersvers/eslint-config
Base configuration for TypeScript projects.@kersvers/eslint-config/react
Additional configuration and rules for projects using React and JSX targeting browser environments.
Create a .npmrc
file in the root of your project to point the npm CLI to GitHub Packages as the npm registry:
@kersvers:registry=https://npm.pkg.github.com/kersvers
Install the package using the following command. You need to be authenticated to GitHub Packages:
$ npm install @kersvers/eslint-config --save-dev
ESLint plugins used by this config must also be installed within your project. This is a limitation within ESLint.
$ npx install-peerdeps --dev @kersvers/eslint-config
Use the extends
feature provided by ESLint in the
project-specific .eslintrc
configuration file.
{
"extends": [
"@kersvers/eslint-config",
"@kersvers/eslint-config/react"
]
}
The following scripts can be added to package.json
to make it easier to start
the linter.
{
"scripts": {
"lint:js": "eslint \"src/**/*.{ts,tsx}\" \"*.js\"",
"lint:fix": "npm run lint:js -- --fix"
}
}