-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: Add eslint config and lint components (#1112)
* style(linting): add eslint config * style(add another): add linting for add another component * style(button menu): fix all lint errors for button menu component * style(filter toggle button): fix all linting errors for filter toggle button * style(multi file upload): fix all linting errors for the multi file upload component * style(multi select): fix all linting errors for multi select component * style(search toggle): fix all linting errors in search toggle component * style(sortable table): fix all linting errors for sortable table component
- Loading branch information
Showing
10 changed files
with
2,389 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
module.exports = { | ||
env: { | ||
browser: 1 | ||
}, | ||
extends: ['standard', 'prettier'], | ||
globals: { | ||
"MOJFrontend": "readonly", | ||
"$": "readonly" | ||
}, | ||
ignorePatterns: [ | ||
'package/**/*', | ||
'node_modules', | ||
'node_modules/.*' | ||
], | ||
overrides: [ | ||
{ | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:import/recommended', | ||
// 'plugin:jest/style', | ||
// 'plugin:jest-dom/recommended', | ||
// 'plugin:jsdoc/recommended-typescript-flavor', | ||
'plugin:n/recommended', | ||
'plugin:promise/recommended', | ||
'prettier' | ||
], | ||
files: [ | ||
'**/*.{cjs,js,mjs}', | ||
], | ||
parserOptions: { | ||
ecmaVersion: 'latest' | ||
}, | ||
// plugins: ['import', 'jsdoc', 'n', 'promise', 'jest', 'jest-dom'], | ||
plugins: ['import', 'jsdoc', 'n', 'promise'], | ||
rules: { | ||
// Check import or require statements are A-Z ordered | ||
'import/order': [ | ||
'error', | ||
{ | ||
alphabetize: { order: 'asc' }, | ||
'newlines-between': 'always' | ||
} | ||
], | ||
|
||
// Check for valid formatting | ||
'jsdoc/check-line-alignment': [ | ||
'warn', | ||
'never', | ||
{ | ||
wrapIndent: ' ' | ||
} | ||
], | ||
|
||
// JSDoc blocks can use `@preserve` to prevent removal | ||
'jsdoc/check-tag-names': [ | ||
'warn', | ||
{ | ||
definedTags: ['preserve'] | ||
} | ||
], | ||
|
||
// JSDoc blocks are optional by default | ||
'jsdoc/require-jsdoc': 'off', | ||
|
||
// JSDoc @param required in (optional) blocks but | ||
// @param description is not necessary by default | ||
'jsdoc/require-param-description': 'off', | ||
'jsdoc/require-param': 'error', | ||
|
||
// Require hyphens before param description | ||
// Aligns with TSDoc style: https://tsdoc.org/pages/tags/param/ | ||
'jsdoc/require-hyphen-before-param-description': 'warn', | ||
|
||
// Maintain new line after description | ||
'jsdoc/tag-lines': [ | ||
'warn', | ||
'never', | ||
{ | ||
startLines: 1 | ||
} | ||
], | ||
|
||
// Automatically use template strings | ||
'no-useless-concat': 'error', | ||
'prefer-template': 'error', | ||
|
||
// Flow control – avoid continue and else blocks after return statements | ||
// in if statements | ||
'no-continue': 'error', | ||
'no-else-return': 'error', | ||
|
||
// Avoid hard to read multi assign statements | ||
'no-multi-assign': 'error' | ||
}, | ||
settings: { | ||
// jsdoc: { | ||
// // Allows us to use type declarations that exist in our dependencies | ||
// mode: 'typescript', | ||
// tagNamePreference: { | ||
// // TypeDoc doesn't understand '@abstract' but '@virtual' | ||
// abstract: 'virtual' | ||
// } | ||
// } | ||
} | ||
}, | ||
{ | ||
// Extensions required for ESM import | ||
files: ['**/*.mjs'], | ||
rules: { | ||
'import/extensions': [ | ||
'error', | ||
'always', | ||
{ | ||
ignorePackages: true, | ||
pattern: { | ||
cjs: 'always', | ||
js: 'always', | ||
mjs: 'always' | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
files: ['**/*.spec.{cjs,js,mjs}'], | ||
env: { | ||
jest: true | ||
} | ||
} | ||
], | ||
parserOptions: { | ||
// project: './tsconfig.json' | ||
}, | ||
root: true | ||
} |
Oops, something went wrong.