eslint-config-glass
v1.0.2
Published
GLASS eslint configuration
Downloads
1
Readme
GLASS-eslint
Eslint configuration for the Glass frontend
The default configuration contains linting rules for javascript, imports, React and Typescript. Optionally, configuration for Node, and testing can be included.
Installation and usage
Install
Note
Make sure Node >= 18 is installed
npm i @uva-glass/eslint-config
Using
Create an .eslintrc.json
file in the root of your project and add the following configuration:
Basic
{
"extends": ["@uva-glass/eslint-config"]
}
This will apply Eslint rules from @typescript-eslint/recommended
, plugin:import/recommended
, plugin:react/recommended
, and plugin:react/jsx-runtime
.
Include rules for testing
{
"extends": [
"@uva-glass/eslint-config",
"@uva-glass/eslint-config/testing-library-react"
]
}
Overriding
The default set of rules is (more or less) equal to those that are available in create-react-app. The reason behind this, is that both Lens and Prism were both initially created from a create-react-app template. For an easy transition, the applicable Eslint rules were copied into this repository.
Some rules might not be too specific or limiting for your code. In those cases, the default configuration can be extended or overwritten. For instance for files that are used on the command line by Jest, but are included in the regular code base:
{
"extends": [
"@uva-glass/eslint-config",
"@uva-glass/eslint-config/testing-library-react"
],
"overrides": [
{
"extends": ["@uva-glass/eslint-config/node"],
"files": ["**/__mocks__/*.js"],
"env": {
"browser": false,
"node": true
},
"rules": {
"import/no-commonjs": "off",
"import/unambiguous": "off"
}
}
]
}