@regionhalland/eslint-config
To use this package, the following packages must be installed in the consuming project.
Package | Version |
---|
ESLint | ^9.15.0 |
TypeScript | ^4.9.5 or ^5 |
Prettier | ^3.1.1 |
Recommended installation:
yarn add -D eslint typescript prettier @regionhalland/eslint-config
Exporting configs:
Name | Description |
---|
standard | Standard config for React project |
recommended | Contains standard config with addition of the plugin simple-import-sort |
strict | Contains recommended config with additional strict rules |
node | Config for Node.js project (using TypeScript) |
commonJs | Config for CommonJs project |
configs | Exports only individual config objects without addition of recommended configs (ESLint, @typescript-eslint) |
utils | Utility for ESLint rules merging |
Sample configurations:
package.json:
{
...
"script": {
"lint": "eslint ./src",
"lint:fix": "eslint ./src --fix"
}
...
}
React application:
import rhEslint from '@regionhalland/eslint-config';
export default [
...rhEslint.recommended,
{
name: 'react-application',
files: ['**/*.ts', '**/*.tsx'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: ['@/features/*/*'],
},
],
},
},
];
Node.js application:
const rhEslint = require('@regionhalland/eslint-config');
module.exports = [
...rhEslint.node,
{
name: 'nodejs-application',
files: ['**/*.js'],
rules: {
'no-undef': 'off',
},
},
];