@regionhalland/eslint-config
v2.1.0
Published
Shared ESLint config for Region Halland TypeScript projects
Downloads
147
Readme
@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-configExporting 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:
// package.json
{
...
"script": {
"lint": "eslint ./src",
"lint:fix": "eslint ./src --fix"
}
...
}React application:
// eslint.config.js (ESLint flat config)
import rhEslint from '@regionhalland/eslint-config';
/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigFile} */
export default [
...rhEslint.recommended,
// Custom config
{
name: 'react-application',
files: ['**/*.ts', '**/*.tsx'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: ['@/features/*/*'],
},
],
},
},
];Node.js application:
// eslint.config.js (ESLint flat config)
const rhEslint = require('@regionhalland/eslint-config');
/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigFile} */
module.exports = [
...rhEslint.node,
// Custom config
{
name: 'nodejs-application',
files: ['**/*.js'],
rules: {
'no-undef': 'off',
},
},
];