From 38deff3392c85953eb01655bbd991a3ad2358b49 Mon Sep 17 00:00:00 2001 From: Sid Vishnoi <8426945+sidvishnoi@users.noreply.github.com> Date: Wed, 24 Mar 2021 03:38:08 +0530 Subject: [PATCH] chore: remove unused files, config and packges (#3400) * chore: remove all trace of jquery * chore(eslintrc): use ignorePatterns instead of .eslintignore * remove all trace of jshint * remove unused karma-mocha dependency * remove unnecessary script from package.json * cleanup eslintrc * missed jquery in package.json --- .eslintignore | 3 -- .eslintrc.json | 10 +--- package-lock.json | 23 --------- package.json | 5 +- profiles/w3c-common.js | 107 ----------------------------------------- src/core/biblio.js | 1 - src/core/ui.js | 1 - src/dini/style.js | 1 - src/type-helper.d.ts | 10 ---- src/w3c/style.js | 1 - tests/.eslintrc.yml | 4 +- tests/.jshintrc | 72 --------------------------- 12 files changed, 3 insertions(+), 235 deletions(-) delete mode 100644 .eslintignore delete mode 100644 profiles/w3c-common.js delete mode 100644 tests/.jshintrc diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index e4dd1f550d..0000000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -builds/* -js/* -!js/profile-w3c-common.js diff --git a/.eslintrc.json b/.eslintrc.json index fe16cffddb..7568beb602 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,10 +1,9 @@ { + "ignorePatterns": ["builds/**", "js/**"], "env": { "browser": true, "es6": true, "node": true, - "jquery": true, - "amd": true, "worker": true }, "extends": ["eslint:recommended", "plugin:prettier/recommended"], @@ -43,13 +42,6 @@ "spaced-comment": ["error", "always", { "block": { "balanced": true } }] }, "globals": { - "flushIframes": true, - "hyperHTML": true, - "makeBasicConfig": true, - "makeDefaultBody": true, - "makeRSDoc": true, - "makeStandardOps": true, - "pickRandomsFromList": true, "respecConfig": true }, "plugins": ["import", "prettier"] diff --git a/package-lock.json b/package-lock.json index 58bb45a047..3136925719 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2360,12 +2360,6 @@ } } }, - "jquery": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", - "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==", - "dev": true - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -2504,23 +2498,6 @@ "integrity": "sha512-PtilRLno5O6wH3lDihRnz0Ba8oSn0YUJqKjjux1peoYGwo0AQqrWRbdWk/RLzcGlb+onTyXAnHl6M+Hu3UxG/Q==", "dev": true }, - "karma-mocha": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/karma-mocha/-/karma-mocha-2.0.1.tgz", - "integrity": "sha512-Tzd5HBjm8his2OA4bouAsATYEpZrp9vC7z5E5j4C5Of5Rrs1jY67RAwXNcVmd/Bnk1wgvQRou0zGVLey44G4tQ==", - "dev": true, - "requires": { - "minimist": "^1.2.3" - }, - "dependencies": { - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true - } - } - }, "karma-mocha-reporter": { "version": "2.2.5", "resolved": "https://registry.npmjs.org/karma-mocha-reporter/-/karma-mocha-reporter-2.2.5.tgz", diff --git a/package.json b/package.json index 223efb3481..8c1e098be5 100644 --- a/package.json +++ b/package.json @@ -42,13 +42,11 @@ "hyperhtml": "^2.34.0", "idb": "^6.0.0", "jasmine": "^3.7.0", - "jquery": "^3.6.0", "karma": "^6.2.0", "karma-chrome-launcher": "^3.1.0", "karma-firefox-launcher": "^2.1.0", "karma-jasmine": "^4.0.1", "karma-jasmine-html-reporter": "^1.5.4", - "karma-mocha": "^2.0.1", "karma-mocha-reporter": "^2.2.5", "karma-safari-launcher": "^1.0.0", "loading-indicator": "^2.0.0", @@ -65,7 +63,6 @@ "build:geonovum-debug": "npm run build:geonovum -- --debug", "build:geonovum": "node ./tools/builder.js geonovum", "build:w3c-debug": "npm run build:w3c -- --debug", - "build:w3c-with-jquery": "node ./tools/builder.js w3c-common", "build:w3c": "node ./tools/builder.js w3c", "build:dini-debug": "node run build:dini -- --debug", "build:dini": "node ./tools/builder.js dini", @@ -78,7 +75,7 @@ "start": "node ./tools/dev-server.js", "test:build": "jasmine --random=false ./tests/test-build.js", "test:headless": "node ./tests/headless.js", - "test:karma": "npm run karma" + "test:karma": "karma start --single-run" }, "dependencies": { "colors": "^1.4.0", diff --git a/profiles/w3c-common.js b/profiles/w3c-common.js deleted file mode 100644 index 161e70de77..0000000000 --- a/profiles/w3c-common.js +++ /dev/null @@ -1,107 +0,0 @@ -/** - * The w3c-common profile is DEPRECATED. - * Update (Apr 15, 2020): The w3c-common profile will no longer receive updates. - * It is frozen at v25.5.0. - * - * The difference between w3c-common and the w3c profile - * is that this profile includes jQuery to support legacy - * specs. - * - * However, you are strongly discouraged from using - * jQuery. Please use vanilla JS/DOM instead: - * - * http://youmightnotneedjquery.com - * - * If you need help, reach out to the ReSpec maintainers. - */ - -"use strict"; -// In case everything else fails, we want the error -window.addEventListener("error", ev => { - console.error(ev.error, ev.message, ev); -}); - -const modules = [ - // order is significant - import("../src/core/base-runner.js"), - import("../src/core/ui.js"), - import("../src/core/jquery-enhanced.js"), - import("../src/core/location-hash.js"), - import("../src/core/l10n.js"), - import("../src/w3c/defaults.js"), - import("../src/core/style.js"), - import("../src/w3c/style.js"), - import("../src/w3c/l10n.js"), - import("../src/core/github.js"), - import("../src/core/data-include.js"), - import("../src/core/markdown.js"), - import("../src/core/reindent.js"), - import("../src/core/title.js"), - import("../src/w3c/level.js"), - import("../src/w3c/headers.js"), - import("../src/w3c/abstract.js"), - import("../src/core/data-transform.js"), - import("../src/core/data-abbr.js"), - import("../src/core/inlines.js"), - import("../src/w3c/conformance.js"), - import("../src/core/dfn.js"), - import("../src/core/pluralize.js"), - import("../src/core/examples.js"), - import("../src/core/issues-notes.js"), - import("../src/core/best-practices.js"), - import("../src/core/figures.js"), - import("../src/core/webidl.js"), - import("../src/core/biblio.js"), - import("../src/core/link-to-dfn.js"), - import("../src/core/xref.js"), - import("../src/core/data-cite.js"), - import("../src/core/webidl-index.js"), - import("../src/core/render-biblio.js"), - import("../src/core/dfn-index.js"), - import("../src/core/contrib.js"), - import("../src/core/fix-headers.js"), - import("../src/core/structure.js"), - import("../src/core/informative.js"), - import("../src/core/id-headers.js"), - import("../src/core/caniuse.js"), - import("../src/core/mdn-annotation.js"), - import("../src/ui/save-html.js"), - import("../src/ui/search-specref.js"), - import("../src/ui/about-respec.js"), - import("../src/core/seo.js"), - import("../src/w3c/seo.js"), - import("../src/core/highlight.js"), - import("../src/core/webidl-clipboard.js"), - import("../src/core/data-tests.js"), - import("../src/core/list-sorter.js"), - import("../src/core/highlight-vars.js"), - import("../src/core/dfn-panel.js"), - import("../src/core/data-type.js"), - import("../src/core/algorithms.js"), - import("../src/core/anchor-expander.js"), - import("../src/core/custom-elements/index.js"), - /* Linter must be the last thing to run */ - import("../src/core/linter.js"), - import("../src/core/a11y.js"), -]; - -async function domReady() { - if (document.readyState === "loading") { - await new Promise(resolve => - document.addEventListener("DOMContentLoaded", resolve) - ); - } -} - -(async () => { - const [runner, { ui }, ...plugins] = await Promise.all(modules); - try { - ui.show(); - await domReady(); - await runner.runAll(plugins); - } finally { - ui.enable(); - } -})().catch(err => { - console.error(err); -}); diff --git a/src/core/biblio.js b/src/core/biblio.js index 77217f65ce..c285af3de5 100644 --- a/src/core/biblio.js +++ b/src/core/biblio.js @@ -4,7 +4,6 @@ // Configuration: // - localBiblio: override or supplement the official biblio with your own. -/* jshint jquery: true */ import { biblioDB } from "./biblio-db.js"; import { createResourceHint } from "./utils.js"; diff --git a/src/core/ui.js b/src/core/ui.js index c5625c00e7..143cb84b80 100644 --- a/src/core/ui.js +++ b/src/core/ui.js @@ -1,7 +1,6 @@ // @ts-check // Module core/ui // Handles the ReSpec UI -/* jshint laxcomma:true */ // XXX TODO // - look at other UI things to add // - list issues diff --git a/src/dini/style.js b/src/dini/style.js index 40921863a7..9b37d42f9d 100644 --- a/src/dini/style.js +++ b/src/dini/style.js @@ -1,5 +1,4 @@ // @ts-check -/* jshint strict: true, browser:true, jquery: true */ // Module dini/style // Inserts a link to the appropriate W3C style for the specification's maturity level. // CONFIGURATION diff --git a/src/type-helper.d.ts b/src/type-helper.d.ts index a4a2da8092..80a4b7e33f 100644 --- a/src/type-helper.d.ts +++ b/src/type-helper.d.ts @@ -46,8 +46,6 @@ interface Window { (deps: string[], callback: (...modules: any[]) => void): void; modules: { [dep: string]: any }; }; - $: JQueryStatic; - jQuery: JQueryStatic; axe?: { run(context: Node, options: any): Promise<{ violations: AxeViolation[] }>; }; @@ -96,14 +94,6 @@ declare namespace Intl { } } -interface JQuery { - renameElement(name: string): JQuery; - getDfnTitles(): string[]; - linkTargets(): import("./core/utils.js").LinkTarget[]; - makeID(pfx?: string, txt?: string, noLC?: boolean): string; - allTextNodes(exclusions: string[]): Text[]; -} - interface BiblioData { aliasOf?: string; id?: string; diff --git a/src/w3c/style.js b/src/w3c/style.js index 72e96cbd35..e1596044cd 100644 --- a/src/w3c/style.js +++ b/src/w3c/style.js @@ -1,5 +1,4 @@ // @ts-check -/* jshint strict: true, browser:true, jquery: true */ // Module w3c/style // Inserts a link to the appropriate W3C style for the specification's maturity level. // CONFIGURATION diff --git a/tests/.eslintrc.yml b/tests/.eslintrc.yml index 5831d147e6..3a43bbe227 100644 --- a/tests/.eslintrc.yml +++ b/tests/.eslintrc.yml @@ -2,7 +2,7 @@ env: jasmine: true node: false extends: - - 'plugin:jasmine/recommended' + - "plugin:jasmine/recommended" parserOptions: sourceType: module rules: @@ -14,5 +14,3 @@ rules: jasmine/prefer-jasmine-matcher: 2 plugins: - jasmine -globals: - expectAsync: true diff --git a/tests/.jshintrc b/tests/.jshintrc deleted file mode 100644 index 4aa4fa817c..0000000000 --- a/tests/.jshintrc +++ /dev/null @@ -1,72 +0,0 @@ -{ - "maxerr": 50, - "bitwise": true, - "camelcase": false, - "curly": true, - "eqeqeq": true, - "forin": true, - "freeze": true, - "immed": false, - "indent": 2, - "latedef": false, - "newcap": true, - "noarg": true, - "noempty": true, - "nonbsp": true, - "nonew": false, - "plusplus": false, - "quotmark": "double", - "unused": "strict", - "maxparams": false, - "maxdepth": 3, - "maxlen": false, - "asi": false, - "boss": false, - "debug": false, - "eqnull": false, - "es5": false, - "moz": true, - "evil": false, - "expr": false, - "funcscope": false, - "iterator": false, - "lastsemic": false, - "laxbreak": false, - "laxcomma": false, - "loopfunc": false, - "multistr": false, - "noyield": true, - "notypeof": false, - "proto": false, - "scripturl": false, - "shadow": false, - "sub": false, - "supernew": false, - "validthis": true, - "browser": true, - "browserify": false, - "couch": false, - "devel": true, - "dojo": false, - "jasmine": true, - "jquery": true, - "mocha": true, - "mootools": false, - "node": true, - "nonstandard": false, - "phantom": false, - "prototypejs": false, - "qunit": false, - "rhino": false, - "shelljs": false, - "typed": false, - "worker": false, - "wsh": false, - "yui": false, - "predef": [ "makeStandardOps", "makeDefaultBody", "makeRSDoc", "flushIframes", "makeBasicConfig", "require", "pickRandomsFromList" ], - "globals": { - "expect": true, - "async": true - }, - "esnext": true -}