Skip to content

Commit

Permalink
Add linting using eslint with standard as the base (#948)
Browse files Browse the repository at this point in the history
* Add linting using eslint with standard as the base

Where possible we want to enforce the coding standards - https://github.com/DEFRA/water-abstraction-team/blob/main/coding_conventions.md

This change introduces eslint using standard as a base (enforcing all the standard js rule). Switching to eslint allows us to extend standard js.

A new command is added to only lint changed files. This will allow us to gradually change and enforce the new linting rules.
  • Loading branch information
jonathangoulding authored May 8, 2024
1 parent 346a95c commit 32b6230
Show file tree
Hide file tree
Showing 3 changed files with 1,989 additions and 900 deletions.
34 changes: 34 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = {
extends: 'standard', // Maintain Standard.js rules
rules: {
'max-len': ['error', {
code: 120
}]
}
}

/*
This is the code to enforce agreed conventions
npm packages needed -
"eslint-plugin-require-sort": "^1.3.0",
"eslint-plugin-sort-keys": "^2.3.5",
module.exports = {
extends: 'standard', // Maintain Standard.js rules
// ignorePatterns: ['test/*'], // we can ignore patterns to allow to gradually enforce lints
plugins: ['sort-keys', 'require-sort'],
rules: {
'func-style': ['error', 'declaration'],
'max-len': ['error', {
code: 120
}],
'require-sort/require-sort': 'error',
'sort-keys': [
'error', 'asc', { caseSensitive: false }
]
}
}
*/
Loading

0 comments on commit 32b6230

Please sign in to comment.