1.0.0 • Published 6 years ago
@schul-cloud/eslint-config v1.0.0
@schul-cloud/eslint-config
This package contains shareable ESLint configuration used by the @schul-cloud applications.
Getting Started
1. Installation
Using npm:
npm install @schul-cloud/eslint-config --save-devUsing Yarn:
yarn add @schul-cloud/eslint-config --dev2. Usage
- Create a new file and name it as
.eslintrc.js - Import relevant config file from
@schul-cloud/eslint-configand just export it as follows.
For JavaScript projects
module.exports = {
extends: '@schul-cloud/eslint-config/javascript',
};For Vue projects
module.exports = {
extends: '@schul-cloud/eslint-config/javascriptVue',
};For Jest tests
You should apply these rules only to your testfiles! Otherwise there will be a lot of false positives. It is recommended to use overrides for that.
module.exports = {
// ... all your normal rules
overrides: [
{
files: ["**/*.unit.js"], // regex that matches your testfiles
extends: ["@schul-cloud/eslint-config/javascriptJest"],
},
],
};Override Default Config
If you want to override the default configuration, then add the following code in .eslintrc.js file:
Override config in JavaScript projects
module.exports = {
extends: '@schul-cloud/eslint-config/javascript',
// your config options goes here, e.g. plugins: [...], rules: { ... }
};Override config in Vue projects
module.exports = {
extends: '@schul-cloud/eslint-config/javascriptVue',
// your config options goes here, e.g. plugins: [...], rules: { ... }
};Override config in Jest tests
module.exports = {
// ... all your normal rules
overrides: [
{
files: ["**/*.unit.js"], // regex that matches your testfiles
extends: ["@schul-cloud/eslint-config/javascriptJest"],
rules: {
// you can adjust the rules here.
},
},
],
};