From c5d6cf698e6ece4952137da57111cdea0b77cf84 Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 18 Jun 2024 15:28:58 -0400 Subject: [PATCH] Back to eslint 8, didnt actually mean to push these to main --- .eslintignore | 26 ++ .eslintrc.js | 200 +++++++++++++ eslint.config.mjs | 270 ------------------ package.json | 10 +- packages/core/rpc/BaseRpcDriver.ts | 1 + .../core/util/offscreenCanvasPonyfill.tsx | 3 - .../LinearPileupDisplay/configSchema.test.js | 89 ++++++ .../models/configSchema.test.js | 67 +++++ ...{index.test.ts.snap => index.test.js.snap} | 0 .../src/{index.test.ts => index.test.js} | 8 +- webpack/config/getHttpsConfig.js | 1 - yarn.lock | 146 ++++++---- 12 files changed, 475 insertions(+), 346 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.js delete mode 100644 eslint.config.mjs create mode 100644 plugins/alignments/src/LinearPileupDisplay/configSchema.test.js create mode 100644 plugins/alignments/src/LinearSNPCoverageDisplay/models/configSchema.test.js rename plugins/authentication/src/__snapshots__/{index.test.ts.snap => index.test.js.snap} (100%) rename plugins/authentication/src/{index.test.ts => index.test.js} (97%) diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..e8877361be --- /dev/null +++ b/.eslintignore @@ -0,0 +1,26 @@ +**/coverage/** +**/templates +**/node_modules/** +**/build/** +**/dist/** +**/esm/** +**/umd/** +**/lib/** +**/tmp/** +**/website/** +# TODO: decide whether or not to bring these up to eslint standards +products/jbrowse-web/scripts/** +/config/ +/products/jbrowse-web/config/ +products/jbrowse-desktop/public/electron.js +products/jbrowse-desktop/public/generateFastaIndex.js +/embedded_demos/ +webpack.config.js +craco.config.js +packages/core/util/QuickLRU.js +packages/core/util/QuickLRU.d.ts +packages/core/util/nanoid.js +packages/core/util/nanoid.d.ts +**/umd_plugin.js +component_tests +.eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000000..9d47447535 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,200 @@ +/** @type {import("eslint").Linter.Config} */ +module.exports = { + root: true, + env: { + browser: true, + node: true, + jest: true, + }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-type-checked', + 'plugin:@typescript-eslint/stylistic-type-checked', + 'plugin:prettier/recommended', + 'plugin:unicorn/recommended', + 'plugin:react/recommended', + 'plugin:react-hooks/recommended', + ], + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + tsconfigRootDir: __dirname, + project: './tsconfig.json', + }, + plugins: ['eslint-plugin-tsdoc', 'react-refresh'], + settings: { + react: { + version: 'detect', + }, + }, + rules: { + 'no-empty': 'off', + 'react-refresh/only-export-components': 'warn', + + '@typescript-eslint/ban-ts-ignore': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/camelcase': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/prefer-nullish-coalescing': 'off', + '@typescript-eslint/no-base-to-string': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { argsIgnorePattern: '^_', ignoreRestSiblings: true }, + ], + '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/restrict-template-expressions': 'off', + '@typescript-eslint/restrict-plus-operands': 'off', + '@typescript-eslint/no-misused-promises': 'off', + '@typescript-eslint/require-await': 'off', + '@typescript-eslint/unbound-method': 'off', + '@typescript-eslint/no-unused-expressions': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + + 'testing-library/render-result-naming-convention': 'off', + 'testing-library/prefer-screen-queries': 'off', + + 'unicorn/no-new-array': 'off', + 'unicorn/no-empty-file': 'off', + 'unicorn/prefer-type-error': 'off', + 'unicorn/prefer-modern-math-apis': 'off', + 'unicorn/prefer-structured-clone': 'off', + 'unicorn/prefer-node-protocol': 'off', + 'unicorn/no-unreadable-array-destructuring': 'off', + 'unicorn/no-abusive-eslint-disable': 'off', + 'unicorn/no-array-callback-reference': 'off', + 'unicorn/number-literal-case': 'off', + 'unicorn/prefer-add-event-listener': 'off', + 'unicorn/prefer-top-level-await': 'off', + 'unicorn/consistent-function-scoping': 'off', + 'unicorn/no-await-expression-member': 'off', + 'unicorn/no-lonely-if': 'off', + 'unicorn/consistent-destructuring': 'off', + 'unicorn/prefer-module': 'off', + 'unicorn/prefer-optional-catch-binding': 'off', + 'unicorn/no-useless-undefined': 'off', + 'unicorn/no-null': 'off', + 'unicorn/no-nested-ternary': 'off', + 'unicorn/filename-case': 'off', + 'unicorn/catch-error-name': 'off', + 'unicorn/prevent-abbreviations': 'off', + 'unicorn/prefer-code-point': 'off', + 'unicorn/numeric-separators-style': 'off', + 'unicorn/no-array-for-each': 'off', + 'unicorn/prefer-spread': 'off', + 'unicorn/explicit-length-check': 'off', + 'unicorn/prefer-regexp-test': 'off', + 'unicorn/relative-url-style': 'off', + 'unicorn/prefer-math-trunc': 'off', + 'unicorn/prefer-query-selector': 'off', + 'unicorn/no-negated-condition': 'off', + 'unicorn/switch-case-braces': 'off', + 'unicorn/prefer-switch': 'off', + 'unicorn/better-regex': 'off', + 'unicorn/no-for-loop': 'off', + 'unicorn/escape-case': 'off', + 'unicorn/prefer-number-properties': 'off', + 'unicorn/no-process-exit': 'off', + + 'no-use-before-define': 'off', + curly: 'error', + 'no-global-assign': 'warn', + 'no-console': [ + 'warn', + { + allow: ['error', 'warn'], + }, + ], + 'no-debugger': 'warn', + 'no-undef': 'error', + 'no-underscore-dangle': 'warn', + + 'prettier/prettier': 'warn', + + 'react/no-danger': 'warn', + 'react/prop-types': 'off', + 'react/destructuring-assignment': 'error', + 'react/no-unused-prop-types': 'error', + 'react/no-unused-state': 'error', + 'react/no-unescaped-entities': 'off', + 'react/prefer-stateless-function': 'error', + + 'spaced-comment': [ + 'error', + 'always', + { + markers: ['/'], + }, + ], + }, + globals: { + globalThis: false, + }, + + overrides: [ + { + files: ['**/*.ts', '**/*.tsx'], + rules: { + 'tsdoc/syntax': 'warn', + }, + }, + { + files: [ + '**/jbrowse-cli/**/*.test.ts', + '**/jbrowse-cli/**/*.test.tsx', + '**/jbrowse-img/**/*.test.ts', + ], + rules: { + 'tsdoc/syntax': 'off', + }, + }, + { + files: [ + '**/test/**', + '**/tests/**', + '**/*.test.[t,j]s', + '**/*.test.[t,j]sx', + '**/rescripts/*', + '**/tests/util.js', + '**/webpack.config.js', + '**/scripts/notarize.js', + '**/src/testUtil.ts', + ], + env: { + jest: true, + }, + globals: { + document: true, + it: true, + describe: true, + test: true, + }, + rules: { + '@typescript-eslint/no-non-null-assertion': 'off', + }, + }, + + { + files: [ + './plugin-development-tools/**/*.[t,j]s', + './plugin-development-tools/**/*.[t,j]sx', + ], + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + project: './plugin-development-tools/tsconfig.json', + }, + }, + ], +} diff --git a/eslint.config.mjs b/eslint.config.mjs deleted file mode 100644 index c0b43bd26c..0000000000 --- a/eslint.config.mjs +++ /dev/null @@ -1,270 +0,0 @@ -import { fixupConfigRules } from '@eslint/compat' -import tsdoc from 'eslint-plugin-tsdoc' -import reactRefresh from 'eslint-plugin-react-refresh' -import globals from 'globals' -import tsParser from '@typescript-eslint/parser' -import path from 'node:path' -import { fileURLToPath } from 'node:url' -import js from '@eslint/js' -import { FlatCompat } from '@eslint/eslintrc' - -// eslint-disable-next-line no-redeclare,no-underscore-dangle -const __filename = fileURLToPath(import.meta.url) -// eslint-disable-next-line no-redeclare,no-underscore-dangle -const __dirname = path.dirname(__filename) -const compat = new FlatCompat({ - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended, - allConfig: js.configs.all, -}) - -export default [ - { - ignores: [ - '**/coverage/**/*', - '**/templates', - '**/node_modules/**/*', - '**/build/**/*', - '**/dist/**/*', - '**/esm/**/*', - '**/umd/**/*', - '**/lib/**/*', - '**/tmp/**/*', - '**/website/**/*', - 'plugin-development-tools/*', - 'products/jbrowse-web/scripts/**/*', - '**/.storybook/*', - 'config/', - 'products/jbrowse-web/config/', - 'products/jbrowse-desktop/public/electron.js', - 'products/jbrowse-desktop/public/generateFastaIndex.js', - 'embedded_demos/', - '**/webpack.config.js', - '**/craco.config.js', - 'packages/core/util/QuickLRU.js', - 'packages/core/util/QuickLRU.d.ts', - 'packages/core/util/nanoid.js', - 'packages/core/util/nanoid.d.ts', - '**/umd_plugin.js', - '**/component_tests', - '**/.eslintrc.js', - ], - }, - ...fixupConfigRules( - compat.extends( - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/recommended-type-checked', - 'plugin:@typescript-eslint/stylistic-type-checked', - 'plugin:prettier/recommended', - 'plugin:unicorn/recommended', - 'plugin:react/recommended', - 'plugin:react-hooks/recommended', - ), - ), - { - plugins: { - tsdoc, - 'react-refresh': reactRefresh, - }, - - languageOptions: { - globals: { - ...globals.browser, - ...globals.node, - ...globals.jest, - globalThis: false, - }, - - parser: tsParser, - ecmaVersion: 5, - sourceType: 'commonjs', - - parserOptions: { - ecmaFeatures: { - jsx: true, - }, - project: './tsconfig.json', - }, - }, - - settings: { - react: { - version: 'detect', - }, - }, - - rules: { - 'no-empty': 'off', - 'react-refresh/only-export-components': 'warn', - '@typescript-eslint/ban-ts-ignore': 'off', - '@typescript-eslint/ban-ts-comment': 'off', - '@typescript-eslint/ban-types': 'off', - '@typescript-eslint/camelcase': 'off', - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/prefer-nullish-coalescing': 'off', - '@typescript-eslint/no-base-to-string': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-empty-function': 'off', - - '@typescript-eslint/no-unused-vars': [ - 'warn', - { - argsIgnorePattern: '^_', - ignoreRestSiblings: true, - }, - ], - - '@typescript-eslint/no-floating-promises': 'error', - '@typescript-eslint/restrict-template-expressions': 'off', - '@typescript-eslint/restrict-plus-operands': 'off', - '@typescript-eslint/no-misused-promises': 'off', - '@typescript-eslint/require-await': 'off', - '@typescript-eslint/unbound-method': 'off', - '@typescript-eslint/no-unused-expressions': 'off', - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/no-unsafe-member-access': 'off', - '@typescript-eslint/no-unsafe-argument': 'off', - '@typescript-eslint/no-unsafe-assignment': 'off', - '@typescript-eslint/no-unsafe-call': 'off', - '@typescript-eslint/no-unsafe-return': 'off', - 'testing-library/render-result-naming-convention': 'off', - 'testing-library/prefer-screen-queries': 'off', - 'unicorn/no-new-array': 'off', - 'unicorn/no-empty-file': 'off', - 'unicorn/prefer-type-error': 'off', - 'unicorn/prefer-modern-math-apis': 'off', - 'unicorn/prefer-structured-clone': 'off', - 'unicorn/prefer-node-protocol': 'off', - 'unicorn/no-unreadable-array-destructuring': 'off', - 'unicorn/no-abusive-eslint-disable': 'off', - 'unicorn/no-array-callback-reference': 'off', - 'unicorn/number-literal-case': 'off', - 'unicorn/prefer-add-event-listener': 'off', - 'unicorn/prefer-top-level-await': 'off', - 'unicorn/consistent-function-scoping': 'off', - 'unicorn/no-await-expression-member': 'off', - 'unicorn/no-lonely-if': 'off', - 'unicorn/consistent-destructuring': 'off', - 'unicorn/prefer-module': 'off', - 'unicorn/prefer-optional-catch-binding': 'off', - 'unicorn/no-useless-undefined': 'off', - 'unicorn/no-null': 'off', - 'unicorn/no-nested-ternary': 'off', - 'unicorn/filename-case': 'off', - 'unicorn/catch-error-name': 'off', - 'unicorn/prevent-abbreviations': 'off', - 'unicorn/prefer-code-point': 'off', - 'unicorn/numeric-separators-style': 'off', - 'unicorn/no-array-for-each': 'off', - 'unicorn/prefer-spread': 'off', - 'unicorn/explicit-length-check': 'off', - 'unicorn/prefer-regexp-test': 'off', - 'unicorn/relative-url-style': 'off', - 'unicorn/prefer-math-trunc': 'off', - 'unicorn/prefer-query-selector': 'off', - 'unicorn/no-negated-condition': 'off', - 'unicorn/switch-case-braces': 'off', - 'unicorn/prefer-switch': 'off', - 'unicorn/better-regex': 'off', - 'unicorn/no-for-loop': 'off', - 'unicorn/escape-case': 'off', - 'unicorn/prefer-number-properties': 'off', - 'unicorn/no-process-exit': 'off', - 'no-use-before-define': 'off', - curly: 'error', - 'no-global-assign': 'warn', - - 'no-console': [ - 'warn', - { - allow: ['error', 'warn'], - }, - ], - - 'no-debugger': 'warn', - 'no-undef': 'error', - 'no-underscore-dangle': 'warn', - 'prettier/prettier': 'warn', - 'react/no-danger': 'warn', - 'react/prop-types': 'off', - 'react/destructuring-assignment': 'error', - 'react/no-unused-prop-types': 'error', - 'react/no-unused-state': 'error', - 'react/no-unescaped-entities': 'off', - 'react/prefer-stateless-function': 'error', - - 'spaced-comment': [ - 'error', - 'always', - { - markers: ['/'], - }, - ], - }, - }, - { - files: ['**/*.ts', '**/*.tsx'], - - rules: { - 'tsdoc/syntax': 'warn', - }, - }, - { - files: [ - '**/jbrowse-cli/**/*.test.ts', - '**/jbrowse-cli/**/*.test.tsx', - '**/jbrowse-img/**/*.test.ts', - ], - - rules: { - 'tsdoc/syntax': 'off', - }, - }, - { - files: [ - '**/test/**', - '**/tests/**', - '**/*.test.[t,j]s', - '**/*.test.[t,j]sx', - '**/rescripts/*', - '**/tests/util.js', - '**/webpack.config.js', - '**/scripts/notarize.js', - '**/src/testUtil.ts', - ], - - languageOptions: { - globals: { - ...globals.jest, - document: true, - it: true, - describe: true, - test: true, - }, - }, - - rules: { - '@typescript-eslint/no-non-null-assertion': 'off', - }, - }, - { - files: [ - './plugin-development-tools/**/*.[t,j]s', - './plugin-development-tools/**/*.[t,j]sx', - ], - - languageOptions: { - ecmaVersion: 5, - sourceType: 'script', - - parserOptions: { - ecmaFeatures: { - jsx: true, - }, - - project: './plugin-development-tools/tsconfig.json', - }, - }, - }, -] diff --git a/package.json b/package.json index 67be95d47a..9d9ea5850d 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "useDist": "lerna run useDist --scope \"@jbrowse/plugin*\" --scope @jbrowse/text-indexing", "useSrc": "lerna run useSrc --scope \"@jbrowse/plugin*\" --scope @jbrowse/text-indexing", "lerna-publish": "lerna publish", - "lint": "eslint --report-unused-disable-directives --max-warnings 0 .", + "lint": "eslint --report-unused-disable-directives --max-warnings 0 --ext .js,.ts,.jsx,.tsx .", "format": "prettier --write .", "check-format": "prettier --check .", "typecheck": "tsc --noEmit", @@ -35,7 +35,6 @@ "@emotion/cache": "^11.7.1", "@emotion/react": "^11.9.0", "@emotion/styled": "^11.8.1", - "@eslint/compat": "^1.1.0", "@mui/material": "^5.10.17", "@mui/system": "^5.14.4", "@mui/x-data-grid": "^7.0.0", @@ -105,7 +104,7 @@ "electron": "31.0.1", "electron-builder": "^24.9.0", "electron-mock-ipc": "^0.3.8", - "eslint": "^9.0.0", + "eslint": "^8.0.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-react": "^7.33.2", @@ -158,8 +157,5 @@ "webpack-dev-server": "^5.0.0", "webpack-manifest-plugin": "^5.0.0" }, - "version": "0.0.0", - "resolutions": { - "globals": "^14.0.0" - } + "version": "0.0.0" } diff --git a/packages/core/rpc/BaseRpcDriver.ts b/packages/core/rpc/BaseRpcDriver.ts index e6730ab164..b2cb4a81d8 100644 --- a/packages/core/rpc/BaseRpcDriver.ts +++ b/packages/core/rpc/BaseRpcDriver.ts @@ -37,6 +37,7 @@ export async function watchWorker( rpcDriverClassName: string, ) { // after first ping succeeds, apply wait for timeout + // eslint-disable-next-line no-constant-condition while (true) { await worker.call('ping', [], { timeout: pingTime * 2, diff --git a/packages/core/util/offscreenCanvasPonyfill.tsx b/packages/core/util/offscreenCanvasPonyfill.tsx index 87c7f4c0b3..49ce5e240d 100644 --- a/packages/core/util/offscreenCanvasPonyfill.tsx +++ b/packages/core/util/offscreenCanvasPonyfill.tsx @@ -39,7 +39,6 @@ const weHave = { if (weHave.realOffscreenCanvas) { createCanvas = (width, height) => new OffscreenCanvas(width, height) - // eslint-disable-next-line no-global-assign createImageBitmap = window.createImageBitmap || self.createImageBitmap ImageBitmapType = window.ImageBitmap || self.ImageBitmap @@ -50,7 +49,6 @@ if (weHave.realOffscreenCanvas) { // eslint-disable-next-line no-undef return nodeCreateCanvas(...args) } - // eslint-disable-next-line no-global-assign createImageBitmap = async (canvas, ...otherargs) => { if (otherargs.length > 0) { throw new Error( @@ -79,7 +77,6 @@ if (weHave.realOffscreenCanvas) { }, } } - // eslint-disable-next-line no-global-assign createImageBitmap = async canvas => { const ctx = canvas.getContext('2d') return { diff --git a/plugins/alignments/src/LinearPileupDisplay/configSchema.test.js b/plugins/alignments/src/LinearPileupDisplay/configSchema.test.js new file mode 100644 index 0000000000..bdaab7666a --- /dev/null +++ b/plugins/alignments/src/LinearPileupDisplay/configSchema.test.js @@ -0,0 +1,89 @@ +import Plugin from '@jbrowse/core/Plugin' +import PluginManager from '@jbrowse/core/PluginManager' +import BoxRendererType from '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType' +import { + svgFeatureRendererConfigSchema, + SvgFeatureRendererReactComponent, +} from '@jbrowse/plugin-svg' +import PileupRenderer from '../PileupRenderer' +import configSchemaFactory from './configSchema' +import modelFactory from './model' +import LinearPileupDisplay from '.' + +// mock warnings to avoid unnecessary outputs +beforeEach(() => { + jest.spyOn(console, 'warn').mockImplementation(() => {}) +}) + +afterEach(() => { + console.warn.mockRestore() +}) + +class PileupRendererPlugin extends Plugin { + install(pluginManager) { + PileupRenderer(pluginManager) + } +} + +class LinearPileupDisplayPlugin extends Plugin { + install(pluginManager) { + LinearPileupDisplay(pluginManager) + } +} + +class SvgFeatureRendererPlugin extends Plugin { + install(pluginManager) { + pluginManager.addRendererType( + () => + new BoxRendererType({ + name: 'SvgFeatureRenderer', + ReactComponent: SvgFeatureRendererReactComponent, + configSchema: svgFeatureRendererConfigSchema, + pluginManager, + }), + ) + } +} + +test('has a type attr', () => { + const configSchema = configSchemaFactory( + new PluginManager([ + new PileupRendererPlugin(), + new SvgFeatureRendererPlugin(), + ]) + .createPluggableElements() + .configure(), + ) + const config = configSchema.create({ + type: 'LinearPileupDisplay', + displayId: 'display0', + name: 'Zonker Display', + }) + expect(config.type).toEqual('LinearPileupDisplay') +}) + +test('set custom jexl filters on linear pileup display', () => { + const configSchema = configSchemaFactory( + new PluginManager([ + new PileupRendererPlugin(), + new SvgFeatureRendererPlugin(), + new LinearPileupDisplayPlugin(), + ]) + .createPluggableElements() + .configure(), + ) + + const config = { + type: 'LinearPileupDisplay', + displayId: 'display0', + name: 'Zonker Display', + } + + const model = modelFactory(configSchema) + const nm = model.create(config) + + expect(nm.jexlFilters).toEqual([]) + const filter = [`jexl:get(feature,'end')==${99319638}`] + nm.setJexlFilters(filter) + expect(nm.jexlFilters).toEqual([`jexl:get(feature,'end')==${99319638}`]) +}) diff --git a/plugins/alignments/src/LinearSNPCoverageDisplay/models/configSchema.test.js b/plugins/alignments/src/LinearSNPCoverageDisplay/models/configSchema.test.js new file mode 100644 index 0000000000..c29a12ce6a --- /dev/null +++ b/plugins/alignments/src/LinearSNPCoverageDisplay/models/configSchema.test.js @@ -0,0 +1,67 @@ +import Plugin from '@jbrowse/core/Plugin' +import PluginManager from '@jbrowse/core/PluginManager' +import SNPCoverageRenderer from '../../SNPCoverageRenderer' // change renderer +import configSchemaFactory from './configSchema' +import LinearSNPCoverageDisplay from '..' +import modelFactory from './model' + +// mock warnings to avoid unnecessary outputs +beforeEach(() => { + jest.spyOn(console, 'warn').mockImplementation(() => {}) +}) + +afterEach(() => { + // @ts-expect-error + console.warn.mockRestore() +}) +// change renderer +class SNPCoverageRendererPlugin extends Plugin { + name = 'SNPCoverageRendererPlugin' + install(pluginManager) { + SNPCoverageRenderer(pluginManager) + } +} +class LinearSNPCoverageDisplayPlugin extends Plugin { + name = 'LinearSNPCoverageDisplayPlugin' + install(pluginManager) { + LinearSNPCoverageDisplay(pluginManager) + } +} + +test('has a type attr', () => { + const configSchema = configSchemaFactory( + new PluginManager([new SNPCoverageRendererPlugin()]) + .createPluggableElements() + .configure(), + ) + const config = configSchema.create({ + type: 'LinearSNPCoverageDisplay', + displayId: 'display1', + name: 'SNPZonker Display', + }) + expect(config.type).toEqual('LinearSNPCoverageDisplay') +}) + +test('set custom jexl filters on linear snp cov display', async () => { + const pm = new PluginManager([ + new SNPCoverageRendererPlugin(), + new LinearSNPCoverageDisplayPlugin(), + ]) + .createPluggableElements() + .configure() + const configSchema = configSchemaFactory(pm) + + const config = { + type: 'LinearSNPCoverageDisplay', + displayId: 'display1', + name: 'SNPZonker Display', + } + + const model = modelFactory(pm, configSchema) + const nm = model.create(config) + + expect(nm.jexlFilters).toEqual([]) + const filter = [`jexl:get(feature,'end')==${99319638}`] + nm.setJexlFilters(filter) + expect(nm.jexlFilters).toEqual([`jexl:get(feature,'end')==${99319638}`]) +}) diff --git a/plugins/authentication/src/__snapshots__/index.test.ts.snap b/plugins/authentication/src/__snapshots__/index.test.js.snap similarity index 100% rename from plugins/authentication/src/__snapshots__/index.test.ts.snap rename to plugins/authentication/src/__snapshots__/index.test.js.snap diff --git a/plugins/authentication/src/index.test.ts b/plugins/authentication/src/index.test.js similarity index 97% rename from plugins/authentication/src/index.test.ts rename to plugins/authentication/src/index.test.js index 7525eda4f4..1d5c35da1b 100644 --- a/plugins/authentication/src/index.test.ts +++ b/plugins/authentication/src/index.test.js @@ -28,10 +28,12 @@ beforeEach(() => { jest.spyOn(console, 'warn').mockImplementation(() => {}) }) +afterEach(() => { + console.warn.mockRestore() +}) + class AuthenticationPlugin extends Plugin { - name = 'AuthenticatedPlugin' - configure() {} - install(pluginManager: PluginManager) { + install(pluginManager) { pluginManager.addInternetAccountType(() => { return new InternetAccountType({ name: 'OAuthInternetAccount', diff --git a/webpack/config/getHttpsConfig.js b/webpack/config/getHttpsConfig.js index cf8f1bb781..0db2e24ae6 100644 --- a/webpack/config/getHttpsConfig.js +++ b/webpack/config/getHttpsConfig.js @@ -2,7 +2,6 @@ const fs = require('fs') const path = require('path') -// eslint-disable-next-line no-redeclare const crypto = require('crypto') const chalk = require('chalk') const paths = require('./paths') diff --git a/yarn.lock b/yarn.lock index 9410bb2403..a31e149075 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2076,21 +2076,22 @@ resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.1.tgz#361461e5cb3845d874e61731c11cfedd664d83a0" integrity sha512-Zm2NGpWELsQAD1xsJzGQpYfvICSsFkEpU0jxBjfdC6uNEWXcHnfs9hScFWtXVDVl+rBQJGrl4g1vcKIejpH9dA== -"@eslint/compat@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@eslint/compat/-/compat-1.1.0.tgz#fdc7d19a66820770bf58ced0342153769d8686f0" - integrity sha512-s9Wi/p25+KbzxKlDm3VshQdImhWk+cbdblhwGNnyCU5lpSwtWa4v7VQCxSki0FAUrGA3s8nCWgYzAH41mwQVKQ== - -"@eslint/config-array@^0.16.0": - version "0.16.0" - resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.16.0.tgz#bb3364fc39ee84ec3a62abdc4b8d988d99dfd706" - integrity sha512-/jmuSd74i4Czf1XXn7wGRWZCuyaUZ330NH1Bek0Pplatt4Sy1S5haN21SCLLdbeKslQ+S0wEJ+++v5YibSi+Lg== +"@eslint/eslintrc@^2.1.4": + version "2.1.4" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad" + integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ== dependencies: - "@eslint/object-schema" "^2.1.4" - debug "^4.3.1" - minimatch "^3.0.5" + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.6.0" + globals "^13.19.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" -"@eslint/eslintrc@^3.0.2", "@eslint/eslintrc@^3.1.0": +"@eslint/eslintrc@^3.0.2": version "3.1.0" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-3.1.0.tgz#dbd3482bfd91efa663cbe7aa1f506839868207b6" integrity sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ== @@ -2105,15 +2106,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@9.5.0": - version "9.5.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.5.0.tgz#0e9c24a670b8a5c86bff97b40be13d8d8f238045" - integrity sha512-A7+AOT2ICkodvtsWnxZP4Xxk3NbZ3VMHd8oihydLRGrJgqqdEz1qSeEgXYyT/Cu8h1TWWsQRejIx48mtjZ5y1w== - -"@eslint/object-schema@^2.1.4": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@eslint/object-schema/-/object-schema-2.1.4.tgz#9e69f8bb4031e11df79e03db09f9dbbae1740843" - integrity sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ== +"@eslint/js@8.57.0": + version "8.57.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.0.tgz#a5417ae8427873f1dd08b70b3574b453e67b5f7f" + integrity sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g== "@fal-works/esbuild-plugin-global-externals@^2.1.2": version "2.1.2" @@ -2306,15 +2302,24 @@ resolved "https://registry.yarnpkg.com/@gmod/vcf/-/vcf-5.0.10.tgz#6c2d7952b15f61642454be90119ea89fd3c227de" integrity sha512-o7QuPcOeXlJpzwQaFmgojhNvJE4yB9fhrfVEDKpkDjV27pAqwMy89367vtXu4JfBFE9t4zZ6sQRkqYaJ+cIheg== +"@humanwhocodes/config-array@^0.11.14": + version "0.11.14" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b" + integrity sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg== + dependencies: + "@humanwhocodes/object-schema" "^2.0.2" + debug "^4.3.1" + minimatch "^3.0.5" + "@humanwhocodes/module-importer@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== -"@humanwhocodes/retry@^0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.3.0.tgz#6d86b8cb322660f03d3f0aa94b99bdd8e172d570" - integrity sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew== +"@humanwhocodes/object-schema@^2.0.2": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" + integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== "@hutson/parse-repository-url@^3.0.0": version "3.0.2" @@ -5612,7 +5617,7 @@ "@typescript-eslint/types" "7.13.1" eslint-visitor-keys "^3.4.3" -"@ungap/structured-clone@^1.0.0": +"@ungap/structured-clone@^1.0.0", "@ungap/structured-clone@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== @@ -5894,7 +5899,7 @@ acorn@^7.4.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -acorn@^8.1.0, acorn@^8.11.0, acorn@^8.11.3, acorn@^8.12.0, acorn@^8.4.1, acorn@^8.7.1, acorn@^8.8.1, acorn@^8.8.2: +acorn@^8.1.0, acorn@^8.11.0, acorn@^8.11.3, acorn@^8.12.0, acorn@^8.4.1, acorn@^8.7.1, acorn@^8.8.1, acorn@^8.8.2, acorn@^8.9.0: version "8.12.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.0.tgz#1627bfa2e058148036133b8d9b51a700663c294c" integrity sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw== @@ -9038,15 +9043,15 @@ eslint-scope@5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-scope@^8.0.1: - version "8.0.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-8.0.1.tgz#a9601e4b81a0b9171657c343fb13111688963cfc" - integrity sha512-pL8XjgP4ZOmmwfFE8mEhSxA7ZY4C+LWyqjQ3o4yWkkmD0qcMT9kkW3zWHOczhWcjTSgqycYAgwSlXvZltv65og== +eslint-scope@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.3: +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: version "3.4.3" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== @@ -9056,37 +9061,41 @@ eslint-visitor-keys@^4.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz#e3adc021aa038a2a8e0b2f8b0ce8f66b9483b1fb" integrity sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw== -eslint@^9.0.0: - version "9.5.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.5.0.tgz#11856034b94a9e1a02cfcc7e96a9f0956963cd2f" - integrity sha512-+NAOZFrW/jFTS3dASCGBxX1pkFD0/fsO+hfAkJ4TyYKwgsXZbqzrw+seCYFCcPCYXvnD67tAnglU7GQTz6kcVw== +eslint@^8.0.0: + version "8.57.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.57.0.tgz#c786a6fd0e0b68941aaf624596fb987089195668" + integrity sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.6.1" - "@eslint/config-array" "^0.16.0" - "@eslint/eslintrc" "^3.1.0" - "@eslint/js" "9.5.0" + "@eslint/eslintrc" "^2.1.4" + "@eslint/js" "8.57.0" + "@humanwhocodes/config-array" "^0.11.14" "@humanwhocodes/module-importer" "^1.0.1" - "@humanwhocodes/retry" "^0.3.0" "@nodelib/fs.walk" "^1.2.8" + "@ungap/structured-clone" "^1.2.0" ajv "^6.12.4" chalk "^4.0.0" cross-spawn "^7.0.2" debug "^4.3.2" + doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^8.0.1" - eslint-visitor-keys "^4.0.0" - espree "^10.0.1" - esquery "^1.5.0" + eslint-scope "^7.2.2" + eslint-visitor-keys "^3.4.3" + espree "^9.6.1" + esquery "^1.4.2" esutils "^2.0.2" fast-deep-equal "^3.1.3" - file-entry-cache "^8.0.0" + file-entry-cache "^6.0.1" find-up "^5.0.0" glob-parent "^6.0.2" + globals "^13.19.0" + graphemer "^1.4.0" ignore "^5.2.0" imurmurhash "^0.1.4" is-glob "^4.0.0" is-path-inside "^3.0.3" + js-yaml "^4.1.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" lodash.merge "^4.6.2" @@ -9105,12 +9114,21 @@ espree@^10.0.1: acorn-jsx "^5.3.2" eslint-visitor-keys "^4.0.0" +espree@^9.6.0, espree@^9.6.1: + version "9.6.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== + dependencies: + acorn "^8.9.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.4.1" + esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.5.0: +esquery@^1.4.2, esquery@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== @@ -9396,12 +9414,12 @@ figures@3.2.0, figures@^3.0.0: dependencies: escape-string-regexp "^1.0.5" -file-entry-cache@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-8.0.0.tgz#7787bddcf1131bffb92636c69457bbc0edd6d81f" - integrity sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ== +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: - flat-cache "^4.0.0" + flat-cache "^3.0.4" file-loader@^6.2.0: version "6.2.0" @@ -9563,14 +9581,6 @@ flat-cache@^3.0.4: keyv "^4.5.3" rimraf "^3.0.2" -flat-cache@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-4.0.1.tgz#0ece39fcb14ee012f4b0410bd33dd9c1f011127c" - integrity sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw== - dependencies: - flatted "^3.2.9" - keyv "^4.5.4" - flat@^5.0.2: version "5.0.2" resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" @@ -10079,7 +10089,19 @@ global-prefix@^3.0.0: kind-of "^6.0.2" which "^1.3.1" -globals@^11.1.0, globals@^14.0.0: +globals@^11.1.0: + version "11.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== + +globals@^13.19.0: + version "13.24.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.24.0.tgz#8432a19d78ce0c1e833949c36adb345400bb1171" + integrity sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ== + dependencies: + type-fest "^0.20.2" + +globals@^14.0.0: version "14.0.0" resolved "https://registry.yarnpkg.com/globals/-/globals-14.0.0.tgz#898d7413c29babcf6bafe56fcadded858ada724e" integrity sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ== @@ -11934,7 +11956,7 @@ keyboardevents-areequal@^0.2.1: resolved "https://registry.yarnpkg.com/keyboardevents-areequal/-/keyboardevents-areequal-0.2.2.tgz#88191ec738ce9f7591c25e9056de928b40277194" integrity sha512-Nv+Kr33T0mEjxR500q+I6IWisOQ0lK1GGOncV0kWE6n4KFmpcu7RUX5/2B0EUtX51Cb0HjZ9VJsSY3u4cBa0kw== -keyv@^4.0.0, keyv@^4.5.3, keyv@^4.5.4: +keyv@^4.0.0, keyv@^4.5.3: version "4.5.4" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==