Skip to content

Commit

Permalink
style: Add eslint config and lint components (#1112)
Browse files Browse the repository at this point in the history
* 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
chrispymm authored Jan 24, 2025
1 parent bd038ee commit d7c1dab
Show file tree
Hide file tree
Showing 10 changed files with 2,389 additions and 306 deletions.
135 changes: 135 additions & 0 deletions .eslintrc.js
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
}
Loading

0 comments on commit d7c1dab

Please sign in to comment.