6eb33f4f6c
* Added a 'Hard-Core' lint mode to pre-commit; this will not automagically fix all your problems, but it will show you where some deeper issues arise. * web: streamline sidebar renderer The sidebar renderer had a lot of repetitive code that could easily be templatized, so I extracted the content from it and turned it into a table. * web: complexity of the Sidebar now below 10. This commit incorporates SonarJS into the pre-commit (and *only* the pre-commit) linting pass; SonarJS is much more comprehensive in its complaints, and it's helpful in breaking long functions down to their simplest forms. In this case, the `renderSidebarItems()` function was considered "unreadable," and I've managed to boil it down to its three special cases (new version, impersonation, and enterprise notification) and its routine case (the rest of the sidebar). Going forward, I'd like all our commits to correspond to the SonarJS settings I've established in .eslint.precommit.json, but I'm not gonna hate on others if they don't quite hit it. :-) * web: modernization continues. Three of our four Babel plug-ins have moved from 'proposed' to 'accepted'; I have updated package.json and the .babelrc file to accept those. Node's ability to set its max_old_space_size via the environment variable was enable in 2019; using it here makes it easier to move this code toward a multi-package monorepo in the future. * Adding 'cross-env' so that the uses of the NODE_OPTIONS environment will work (theoretically) on Windows.
29 lines
837 B
JSON
29 lines
837 B
JSON
{
|
|
"env": {
|
|
"browser": true,
|
|
"es2021": true
|
|
},
|
|
"extends": [
|
|
"eslint:recommended",
|
|
"plugin:@typescript-eslint/recommended",
|
|
"plugin:lit/recommended",
|
|
"plugin:custom-elements/recommended",
|
|
"plugin:storybook/recommended",
|
|
"plugin:sonarjs/recommended"
|
|
],
|
|
"parser": "@typescript-eslint/parser",
|
|
"parserOptions": {
|
|
"ecmaVersion": 12,
|
|
"sourceType": "module"
|
|
},
|
|
"plugins": ["@typescript-eslint", "lit", "custom-elements", "sonarjs"],
|
|
"rules": {
|
|
"indent": "off",
|
|
"linebreak-style": ["error", "unix"],
|
|
"quotes": ["error", "double", { "avoidEscape": true }],
|
|
"semi": ["error", "always"],
|
|
"@typescript-eslint/ban-ts-comment": "off",
|
|
"sonarjs/cognitive-complexity": ["error", 9]
|
|
}
|
|
}
|