2022-02-11 19:09:58 +00:00
|
|
|
const LEGACY_FILES = ['example/**'];
|
2024-03-26 23:52:33 +00:00
|
|
|
/** @type {import('eslint').Linter.Config} */
|
|
|
|
const config = {
|
2018-08-07 21:47:50 +00:00
|
|
|
env: {
|
|
|
|
browser: true,
|
2024-03-26 23:52:33 +00:00
|
|
|
es2024: true,
|
2018-08-07 21:47:50 +00:00
|
|
|
jasmine: true,
|
2024-08-07 21:36:14 +00:00
|
|
|
amd: true,
|
|
|
|
node: true
|
2018-08-07 21:47:50 +00:00
|
|
|
},
|
2019-12-04 20:39:09 +00:00
|
|
|
globals: {
|
2024-07-31 17:46:16 +00:00
|
|
|
_: 'readonly',
|
|
|
|
__webpack_public_path__: 'writeable',
|
|
|
|
__OPENMCT_VERSION__: 'readonly',
|
|
|
|
__OPENMCT_BUILD_DATE__: 'readonly',
|
|
|
|
__OPENMCT_REVISION__: 'readonly',
|
|
|
|
__OPENMCT_BUILD_BRANCH__: 'readonly'
|
2019-12-04 20:39:09 +00:00
|
|
|
},
|
2023-09-14 16:55:44 +00:00
|
|
|
plugins: ['prettier', 'unicorn', 'simple-import-sort'],
|
2018-08-07 21:47:50 +00:00
|
|
|
extends: [
|
|
|
|
'eslint:recommended',
|
2022-03-21 19:27:18 +00:00
|
|
|
'plugin:compat/recommended',
|
2023-08-14 17:03:19 +00:00
|
|
|
'plugin:vue/vue3-recommended',
|
2023-05-18 21:29:20 +00:00
|
|
|
'plugin:you-dont-need-lodash-underscore/compatible',
|
2023-10-16 16:26:12 +00:00
|
|
|
'plugin:prettier/recommended',
|
|
|
|
'plugin:no-unsanitized/DOM'
|
2023-05-18 21:54:46 +00:00
|
|
|
],
|
2018-08-07 21:47:50 +00:00
|
|
|
parser: 'vue-eslint-parser',
|
|
|
|
parserOptions: {
|
2023-05-18 21:29:20 +00:00
|
|
|
parser: '@babel/eslint-parser',
|
|
|
|
requireConfigFile: false,
|
2018-08-07 21:47:50 +00:00
|
|
|
allowImportExportEverywhere: true,
|
2024-03-26 23:52:33 +00:00
|
|
|
ecmaVersion: 'latest',
|
2018-08-07 21:47:50 +00:00
|
|
|
ecmaFeatures: {
|
2023-05-18 21:29:20 +00:00
|
|
|
impliedStrict: true
|
2024-03-26 23:52:33 +00:00
|
|
|
},
|
|
|
|
sourceType: 'module'
|
2023-05-18 21:54:46 +00:00
|
|
|
},
|
|
|
|
rules: {
|
2023-08-31 20:40:00 +00:00
|
|
|
'simple-import-sort/imports': 'warn',
|
|
|
|
'simple-import-sort/exports': 'warn',
|
2023-08-14 17:03:19 +00:00
|
|
|
'vue/no-deprecated-dollar-listeners-api': 'warn',
|
|
|
|
'vue/no-deprecated-events-api': 'warn',
|
2023-07-19 18:22:23 +00:00
|
|
|
'vue/no-v-for-template-key': 'off',
|
|
|
|
'vue/no-v-for-template-key-on-child': 'error',
|
2024-07-24 03:41:07 +00:00
|
|
|
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
|
2023-05-18 21:29:20 +00:00
|
|
|
'prettier/prettier': 'error',
|
|
|
|
'you-dont-need-lodash-underscore/omit': 'off',
|
2020-05-27 17:59:02 +00:00
|
|
|
'you-dont-need-lodash-underscore/throttle': 'off',
|
|
|
|
'you-dont-need-lodash-underscore/flatten': 'off',
|
2022-05-26 16:45:16 +00:00
|
|
|
'you-dont-need-lodash-underscore/get': 'off',
|
2018-08-07 21:47:50 +00:00
|
|
|
'no-bitwise': 'error',
|
|
|
|
curly: 'error',
|
|
|
|
eqeqeq: 'error',
|
|
|
|
'guard-for-in': 'error',
|
2023-05-18 21:29:20 +00:00
|
|
|
'no-extend-native': 'error',
|
2018-08-07 21:47:50 +00:00
|
|
|
'no-inner-declarations': 'off',
|
|
|
|
'no-use-before-define': ['error', 'nofunc'],
|
|
|
|
'no-caller': 'error',
|
|
|
|
'no-irregular-whitespace': 'error',
|
|
|
|
'no-new': 'error',
|
|
|
|
'no-shadow': 'error',
|
|
|
|
'no-undef': 'error',
|
|
|
|
'no-unused-vars': [
|
2023-05-18 21:54:46 +00:00
|
|
|
'error',
|
|
|
|
{
|
|
|
|
vars: 'all',
|
|
|
|
args: 'none'
|
|
|
|
}
|
2019-12-04 20:39:09 +00:00
|
|
|
],
|
2020-05-27 17:59:02 +00:00
|
|
|
'no-console': 'off',
|
|
|
|
'new-cap': [
|
2018-08-07 21:47:50 +00:00
|
|
|
'error',
|
2023-05-18 21:54:46 +00:00
|
|
|
{
|
2018-08-07 21:47:50 +00:00
|
|
|
capIsNew: false,
|
|
|
|
properties: false
|
|
|
|
}
|
|
|
|
],
|
|
|
|
'dot-notation': 'error',
|
2020-05-16 23:19:36 +00:00
|
|
|
|
|
|
|
// https://eslint.org/docs/rules/no-case-declarations
|
|
|
|
'no-case-declarations': 'error',
|
|
|
|
// https://eslint.org/docs/rules/max-classes-per-file
|
|
|
|
'max-classes-per-file': ['error', 1],
|
|
|
|
// https://eslint.org/docs/rules/no-eq-null
|
|
|
|
'no-eq-null': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-eval
|
|
|
|
'no-eval': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-implicit-globals
|
|
|
|
'no-implicit-globals': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-implied-eval
|
|
|
|
'no-implied-eval': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-lone-blocks
|
|
|
|
'no-lone-blocks': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-loop-func
|
|
|
|
'no-loop-func': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-new-func
|
|
|
|
'no-new-func': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-new-wrappers
|
|
|
|
'no-new-wrappers': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-octal-escape
|
|
|
|
'no-octal-escape': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-proto
|
|
|
|
'no-proto': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-return-await
|
|
|
|
'no-return-await': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-script-url
|
|
|
|
'no-script-url': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-self-compare
|
|
|
|
'no-self-compare': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-sequences
|
|
|
|
'no-sequences': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
|
|
|
'no-unmodified-loop-condition': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-useless-call
|
|
|
|
'no-useless-call': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-nested-ternary
|
|
|
|
'no-nested-ternary': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-useless-computed-key
|
|
|
|
'no-useless-computed-key': 'error',
|
2020-08-10 19:13:23 +00:00
|
|
|
// https://eslint.org/docs/rules/no-var
|
|
|
|
'no-var': 'error',
|
|
|
|
// https://eslint.org/docs/rules/one-var
|
|
|
|
'one-var': ['error', 'never'],
|
2020-08-10 18:23:35 +00:00
|
|
|
// https://eslint.org/docs/rules/default-case-last
|
|
|
|
'default-case-last': 'error',
|
|
|
|
// https://eslint.org/docs/rules/default-param-last
|
|
|
|
'default-param-last': 'error',
|
|
|
|
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
|
|
|
'grouped-accessor-pairs': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-constructor-return
|
|
|
|
'no-constructor-return': 'error',
|
2020-08-10 17:59:18 +00:00
|
|
|
// https://eslint.org/docs/rules/array-callback-return
|
|
|
|
'array-callback-return': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-invalid-this
|
|
|
|
'no-invalid-this': 'error', // Believe this one actually surfaces some bugs
|
|
|
|
// https://eslint.org/docs/rules/func-style
|
|
|
|
'func-style': ['error', 'declaration'],
|
2020-08-10 17:35:40 +00:00
|
|
|
// https://eslint.org/docs/rules/no-unused-expressions
|
|
|
|
'no-unused-expressions': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-useless-concat
|
|
|
|
'no-useless-concat': 'error',
|
|
|
|
// https://eslint.org/docs/rules/radix
|
|
|
|
radix: 'error',
|
|
|
|
// https://eslint.org/docs/rules/require-await
|
|
|
|
'require-await': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-alert
|
|
|
|
'no-alert': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-useless-constructor
|
|
|
|
'no-useless-constructor': 'error',
|
|
|
|
// https://eslint.org/docs/rules/no-duplicate-imports
|
|
|
|
'no-duplicate-imports': 'error',
|
2020-05-16 23:19:36 +00:00
|
|
|
|
2020-07-31 19:11:03 +00:00
|
|
|
// https://eslint.org/docs/rules/no-implicit-coercion
|
|
|
|
'no-implicit-coercion': 'error',
|
|
|
|
//https://eslint.org/docs/rules/no-unneeded-ternary
|
|
|
|
'no-unneeded-ternary': 'error',
|
2023-10-10 20:29:01 +00:00
|
|
|
'unicorn/filename-case': [
|
|
|
|
'error',
|
2023-09-14 16:55:44 +00:00
|
|
|
{
|
2023-10-10 20:29:01 +00:00
|
|
|
cases: {
|
|
|
|
pascalCase: true
|
2023-09-14 16:55:44 +00:00
|
|
|
},
|
2024-03-26 23:52:33 +00:00
|
|
|
ignore: ['^.*\\.(js|cjs|mjs)$']
|
2023-09-14 16:55:44 +00:00
|
|
|
}
|
|
|
|
],
|
2018-08-07 21:47:50 +00:00
|
|
|
'vue/first-attribute-linebreak': 'error',
|
|
|
|
'vue/multiline-html-element-content-newline': 'off',
|
2020-08-10 18:23:35 +00:00
|
|
|
'vue/singleline-html-element-content-newline': 'off',
|
2023-10-10 20:29:01 +00:00
|
|
|
'vue/no-mutating-props': 'off' // TODO: Remove this rule and fix resulting errors
|
2018-08-07 21:47:50 +00:00
|
|
|
},
|
|
|
|
overrides: [
|
|
|
|
{
|
2020-08-10 18:23:35 +00:00
|
|
|
files: LEGACY_FILES,
|
2018-08-07 21:47:50 +00:00
|
|
|
rules: {
|
|
|
|
'no-unused-vars': [
|
2023-10-10 20:29:01 +00:00
|
|
|
'error',
|
2018-08-07 21:47:50 +00:00
|
|
|
{
|
|
|
|
vars: 'all',
|
|
|
|
args: 'none',
|
2020-08-10 18:23:35 +00:00
|
|
|
varsIgnorePattern: 'controller'
|
2018-08-07 21:47:50 +00:00
|
|
|
}
|
2020-08-10 18:23:35 +00:00
|
|
|
],
|
2020-05-16 23:19:36 +00:00
|
|
|
'no-nested-ternary': 'off',
|
2020-08-10 19:13:23 +00:00
|
|
|
'no-var': 'off',
|
|
|
|
'one-var': 'off'
|
2020-05-16 23:19:36 +00:00
|
|
|
}
|
2018-08-07 21:47:50 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
2024-03-26 23:52:33 +00:00
|
|
|
|
|
|
|
module.exports = config;
|