openmct/.eslintrc.cjs
John Hill 0413e77d8a
test(e2e): Major refactor and stabilization of e2e tests (#7581)
* fix: update broken locator

* update eslint package

* first pass of lint fixes

* update package

* change ruleset

* update component tests to match linting rules

* driveby

* start to factor out bad locators

* update gauge component

* update notebook snapshot drop area

* Update plot aria

* add draggable true to tree items

* update package

* driveby to remove dead code

* unneeded

* unneeded

* tells a screenreader that this is a row and a cell

* adds an id for dragondrops

* this should be a button

* first pass at fixing tooltip selectors

* review comments

* Updating more tests

* update to remove expect expect given our use of check functions

* add expand component

* move role around

* update more locators

* force

* new local storage

* remove choochoo steps

* test: do `lint:fix` and also add back accidentally removed code

* test: add back more removed code

* test: remove `unstable` annotation from tests which are not unstable

* test: remove invalid test-- the "new" time conductor doesn't allow for millisecond changes in fixed time

* test: fix unstable gauge test

* test: remove useless asserts-- this was secretly non-functional. now that we've fixed it, it makes no sense and just fails

* test: add back accidentally removed changes

* test: revert changes that break test

* test: more fixes

* Remove all notion of the unstable/stable e2e tests

* test: eviscerate the flake with FACTS and LOGIC

* test: fix anotha one

* lint fixes

* test: no need to wait for save dialog

* test: fix more tests

* lint: fix more warnings

* test: fix anotha one

* test: use `toHaveLength` instead of `.length).toBe()`

* test: stabilize tabs view example imagery test

* fix: more tests be fixed

* test: more `toHaveCount()`s please

* test: revert more accidentally removed fixes

* test: fix selector

* test: fix anotha one

* update lint rules to clean up bad locators in shared fixtures

* update and remove bad appActions

* test: fix some restricted notebook tests

* test: mass find/replace to enforce `toHaveCount()` instead of `.count()).toBe()`

* Remove some bad appActions and update text

* test: fix da tree tests

* test: await not await await

* test: fix upload plan appAction and add a11y

* Updating externalFixtures with best practice locators and add missing appAction framework tests

* test: fix test

* test: fix appAction test for plans

* test: yum yum fix'em up and get rid of some dragon drops

* fix: alas, a `.only()` got my hopes up that i was done fixing tests

* test: add `setTimeConductorMode` test "suite" which covers most TC related appActions

* test: fix arg

* test(couchdb): fix some network tests via expect polling

* Stabalize visual test

* getCanasPixels

* test: stabilize tooltip telemetry table test, better a11y for tooltips

* chore: update to use `docker compose` instead of `docker-compose`

* New rules, new tests, new me

* fix sort order

* test: add `waitForPlotsToRender` framework test, passthru timeout override

* test: remove `clockOptions` test as we have `page.clock` now

* test: refactor out `overrideClock`

* test: use `clock.install` instead

* test: use `clock.install` instead

* time clock fix

* test: fix timer tests

* remove ever reference to old base fixture

* test: stabilize restricted notebook test

* lint fixes

* test: use clock.install

* update timelist

* test: update visual tests to use `page.clock()`, update snapshots

* test: stabilize tree renaming/reordering test

* a11y: add aria-label and role=region to object view

* refactor: use `dragTo`

* refactor: use `dragTo`, other small fixes

* test: use `page.clock()` to stabilize tooltip telemetry table test

* test: use web-first assertion to stabilize staleness test

* test: knock out a few more `page.click`s

* test: destroy all `page.click()`s

* refactor: consistently use `'Ok'` instead of `'OK'` and `'Ok'` mixed

* test: remove gauge aria label

* test: more test fixes

* test: more fixes and refactors

* docs: add comment

* test: refactor all instances of `dragAndDrop`

* test: remove redundant test (covered in previous test steps)

* test: stabilize imagery operations tests for display layout

* chore: remove bad unicorn rule

* chore(lint): remove unused disable directives

---------

Co-authored-by: Jesse Mazzella <jesse.d.mazzella@nasa.gov>
2024-08-07 21:36:14 +00:00

193 lines
6.2 KiB
JavaScript

const LEGACY_FILES = ['example/**'];
/** @type {import('eslint').Linter.Config} */
const config = {
env: {
browser: true,
es2024: true,
jasmine: true,
amd: true,
node: true
},
globals: {
_: 'readonly',
__webpack_public_path__: 'writeable',
__OPENMCT_VERSION__: 'readonly',
__OPENMCT_BUILD_DATE__: 'readonly',
__OPENMCT_REVISION__: 'readonly',
__OPENMCT_BUILD_BRANCH__: 'readonly'
},
plugins: ['prettier', 'unicorn', 'simple-import-sort'],
extends: [
'eslint:recommended',
'plugin:compat/recommended',
'plugin:vue/vue3-recommended',
'plugin:you-dont-need-lodash-underscore/compatible',
'plugin:prettier/recommended',
'plugin:no-unsanitized/DOM'
],
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@babel/eslint-parser',
requireConfigFile: false,
allowImportExportEverywhere: true,
ecmaVersion: 'latest',
ecmaFeatures: {
impliedStrict: true
},
sourceType: 'module'
},
rules: {
'simple-import-sort/imports': 'warn',
'simple-import-sort/exports': 'warn',
'vue/no-deprecated-dollar-listeners-api': 'warn',
'vue/no-deprecated-events-api': 'warn',
'vue/no-v-for-template-key': 'off',
'vue/no-v-for-template-key-on-child': 'error',
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
'prettier/prettier': 'error',
'you-dont-need-lodash-underscore/omit': 'off',
'you-dont-need-lodash-underscore/throttle': 'off',
'you-dont-need-lodash-underscore/flatten': 'off',
'you-dont-need-lodash-underscore/get': 'off',
'no-bitwise': 'error',
curly: 'error',
eqeqeq: 'error',
'guard-for-in': 'error',
'no-extend-native': 'error',
'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': [
'error',
{
vars: 'all',
args: 'none'
}
],
'no-console': 'off',
'new-cap': [
'error',
{
capIsNew: false,
properties: false
}
],
'dot-notation': 'error',
// 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',
// https://eslint.org/docs/rules/no-var
'no-var': 'error',
// https://eslint.org/docs/rules/one-var
'one-var': ['error', 'never'],
// 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',
// 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'],
// 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',
// https://eslint.org/docs/rules/no-implicit-coercion
'no-implicit-coercion': 'error',
//https://eslint.org/docs/rules/no-unneeded-ternary
'no-unneeded-ternary': 'error',
'unicorn/filename-case': [
'error',
{
cases: {
pascalCase: true
},
ignore: ['^.*\\.(js|cjs|mjs)$']
}
],
'vue/first-attribute-linebreak': 'error',
'vue/multiline-html-element-content-newline': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/no-mutating-props': 'off' // TODO: Remove this rule and fix resulting errors
},
overrides: [
{
files: LEGACY_FILES,
rules: {
'no-unused-vars': [
'error',
{
vars: 'all',
args: 'none',
varsIgnorePattern: 'controller'
}
],
'no-nested-ternary': 'off',
'no-var': 'off',
'one-var': 'off'
}
}
]
};
module.exports = config;