Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ui] remove linting functionality and dependencies #21724

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 1 addition & 36 deletions ui/packages/consul-ui/app/components/code-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@
import Component from '@ember/component';
import { set } from '@ember/object';
import { inject as service } from '@ember/service';
const DEFAULTS = {

Check failure on line 9 in ui/packages/consul-ui/app/components/code-editor/index.js

View workflow job for this annotation

GitHub Actions / node-tests

'DEFAULTS' is assigned a value but never used
tabSize: 2,
lineNumbers: true,
theme: 'hashi',
showCursorWhenSelecting: true,
gutters: ['CodeMirror-lint-markers'],
lint: true,
};
export default Component.extend({
settings: service('settings'),
dom: service('dom'),
helper: service('code-mirror/linter'),
classNames: ['code-editor'],
readonly: false,
syntax: '',
Expand All @@ -26,7 +23,6 @@
oninput: function () {},
init: function () {
this._super(...arguments);
set(this, 'modes', this.helper.modes());
},
didReceiveAttrs: function () {
this._super(...arguments);
Expand All @@ -35,26 +31,6 @@
editor.setOption('readOnly', this.readonly);
}
},
setMode: function (mode) {
if (!this.isDestroying && !this.isDestroyed) {
let options = {
...DEFAULTS,
mode: mode.mime,
readOnly: this.readonly,
};
if (mode.name === 'XML') {
options.htmlMode = mode.htmlMode;
options.matchClosing = mode.matchClosing;
options.alignCDATA = mode.alignCDATA;
}
set(this, 'options', options);

const editor = this.editor;
editor.setOption('mode', mode.mime);
this.helper.lint(editor, mode.mode);
set(this, 'mode', mode);
}
},
willDestroyElement: function () {
this._super(...arguments);
if (this.observer) {
Expand All @@ -76,18 +52,7 @@
});
set(this, 'value', $code.firstChild.wholeText);
}
set(this, 'editor', this.helper.getEditor(this.element));
this.settings.findBySlug('code-editor').then((mode) => {
const modes = this.modes;
const syntax = this.syntax;
if (syntax) {
mode = modes.find(function (item) {
return item.name.toLowerCase() == syntax.toLowerCase();
});
}
mode = !mode ? modes[0] : mode;
this.setMode(mode);
});
set(this, 'editor', this.dom.element('textarea + div', this.element).CodeMirror);
},
didAppear: function () {
this.editor.refresh();
Expand Down
51 changes: 0 additions & 51 deletions ui/packages/consul-ui/app/services/code-mirror/linter.js

This file was deleted.

43 changes: 0 additions & 43 deletions ui/packages/consul-ui/app/utils/editor/lint.js

This file was deleted.

32 changes: 1 addition & 31 deletions ui/packages/consul-ui/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,7 @@ module.exports = function (defaults, $ = process.env) {
},
codemirror: {
keyMaps: ['sublime'],
addonFiles: [
'lint/lint.css',
'lint/lint.js',
'lint/json-lint.js',
'lint/yaml-lint.js',
'mode/loadmode.js',
],
addonFiles: ['mode/loadmode.js'],
},
sassOptions: {
implementation: require('sass'),
Expand Down Expand Up @@ -270,30 +264,6 @@ module.exports = function (defaults, $ = process.env) {
// CSS.escape polyfill
app.import('node_modules/css.escape/css.escape.js', { outputFile: 'assets/css.escape.js' });

// JSON linting support. Possibly dynamically loaded via CodeMirror linting. See components/code-editor.js
app.import('node_modules/jsonlint/lib/jsonlint.js', {
outputFile: 'assets/codemirror/mode/javascript/javascript.js',
});
app.import('node_modules/codemirror/mode/javascript/javascript.js', {
outputFile: 'assets/codemirror/mode/javascript/javascript.js',
});

// HCL/Ruby linting support. Possibly dynamically loaded via CodeMirror linting. See components/code-editor.js
app.import('node_modules/codemirror/mode/ruby/ruby.js', {
outputFile: 'assets/codemirror/mode/ruby/ruby.js',
});

// YAML linting support. Possibly dynamically loaded via CodeMirror linting. See components/code-editor.js
app.import('node_modules/js-yaml/dist/js-yaml.js', {
outputFile: 'assets/codemirror/mode/yaml/yaml.js',
});
app.import('node_modules/codemirror/mode/yaml/yaml.js', {
outputFile: 'assets/codemirror/mode/yaml/yaml.js',
});
// XML linting support. Possibly dynamically loaded via CodeMirror linting. See services/code-mirror/linter.js
app.import('node_modules/codemirror/mode/xml/xml.js', {
outputFile: 'assets/codemirror/mode/xml/xml.js',
});
// metrics-providers
app.import('vendor/metrics-providers/consul.js', {
outputFile: 'assets/metrics-providers/consul.js',
Expand Down
1 change: 0 additions & 1 deletion ui/packages/consul-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
"husky": "^4.2.5",
"ivy-codemirror": "^2.1.0",
"js-yaml": "^4.0.0",
"jsonlint": "^1.6.3",
"lint-staged": "^10.2.11",
"loader.js": "^4.7.0",
"mnemonist": "^0.38.0",
Expand Down

This file was deleted.

50 changes: 0 additions & 50 deletions ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2698,11 +2698,6 @@
resolved "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d"
integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==

JSV@^4.0.x:
version "4.0.2"
resolved "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz#d077f6825571f82132f9dffaed587b4029feff57"
integrity sha512-ZJ6wx9xaKJ3yFUhq5/sk82PJMuUyLk277I8mQeyDgCTjGdjWJIvPfaU5LIXaMuaN2UO1X3kZH4+lgphublZUHw==

a11y-dialog@^6.0.1:
version "6.1.2"
resolved "https://registry.npmjs.org/a11y-dialog/-/a11y-dialog-6.1.2.tgz#7c6a1d3720462db2f2fde6badba63478fd3cc871"
Expand Down Expand Up @@ -2913,11 +2908,6 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0:
dependencies:
color-convert "^2.0.1"

ansi-styles@~1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz#cb102df1c56f5123eab8b67cd7b98027a0279178"
integrity sha512-3iF4FIKdxaVYT3JqQuY3Wat/T2t7TRbbQ94Fu50ZUCbLy4TFbTzr90NOHQodQkNqmeEGCw8WbeP78WNi6SKYUA==

ansi-to-html@^0.6.15, ansi-to-html@^0.6.6:
version "0.6.15"
resolved "https://registry.npmjs.org/ansi-to-html/-/ansi-to-html-0.6.15.tgz#ac6ad4798a00f6aa045535d7f6a9cb9294eebea7"
Expand Down Expand Up @@ -5050,15 +5040,6 @@ chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2:
ansi-styles "^4.1.0"
supports-color "^7.1.0"

chalk@~0.4.0:
version "0.4.0"
resolved "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz#5199a3ddcd0c1efe23bc08c1b027b06176e0c64f"
integrity sha512-sQfYDlfv2DGVtjdoQqxS0cEZDroyG8h6TamA6rvxwlrU5BaSLDx9xhatBYl2pxZ7gmpNaPFVwBtdGdu5rQ+tYQ==
dependencies:
ansi-styles "~1.0.0"
has-color "~0.1.0"
strip-ansi "~0.1.0"

character-entities-html4@^1.0.0:
version "1.1.4"
resolved "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-1.1.4.tgz#0e64b0a3753ddbf1fdc044c5fd01d0199a02e125"
Expand Down Expand Up @@ -9336,11 +9317,6 @@ has-bigints@^1.0.1, has-bigints@^1.0.2:
resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa"
integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==

has-color@~0.1.0:
version "0.1.7"
resolved "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz#67144a5260c34fc3cca677d041daf52fe7b78b2f"
integrity sha512-kaNz5OTAYYmt646Hkqw50/qyxP2vFnTVu5AQ1Zmk22Kk5+4Qx6BpO8+u7IKsML5fOsFk0ZT0AcCJNYwcvaLBvw==

has-dynamic-import@^2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/has-dynamic-import/-/has-dynamic-import-2.1.0.tgz#06359ad7672b9e764aea93a54bb9d6e17542d34c"
Expand Down Expand Up @@ -10557,14 +10533,6 @@ jsonify@^0.0.1:
resolved "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz#2aa3111dae3d34a0f151c63f3a45d995d9420978"
integrity sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==

jsonlint@^1.6.3:
version "1.6.3"
resolved "https://registry.npmjs.org/jsonlint/-/jsonlint-1.6.3.tgz#cb5e31efc0b78291d0d862fbef05900adf212988"
integrity sha512-jMVTMzP+7gU/IyC6hvKyWpUU8tmTkK5b3BPNuMI9U8Sit+YAWLlZwB6Y6YrdCxfg2kNz05p3XY3Bmm4m26Nv3A==
dependencies:
JSV "^4.0.x"
nomnom "^1.5.x"

just-extend@^4.0.2:
version "4.2.1"
resolved "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz#ef5e589afb61e5d66b24eca749409a8939a8c744"
Expand Down Expand Up @@ -11868,14 +11836,6 @@ node-watch@0.7.3:
resolved "https://registry.npmjs.org/node-watch/-/node-watch-0.7.3.tgz#6d4db88e39c8d09d3ea61d6568d80e5975abc7ab"
integrity sha512-3l4E8uMPY1HdMMryPRUAl+oIHtXtyiTlIiESNSVSNxcPfzAFzeTbXFQkZfAwBbo0B1qMSG8nUABx+Gd+YrbKrQ==

nomnom@^1.5.x:
version "1.8.1"
resolved "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz#2151f722472ba79e50a76fc125bb8c8f2e4dc2a7"
integrity sha512-5s0JxqhDx9/rksG2BTMVN1enjWSvPidpoSgViZU4ZXULyTe+7jxcCRLB6f42Z0l1xYJpleCBtSyY6Lwg3uu5CQ==
dependencies:
chalk "~0.4.0"
underscore "~1.6.0"

nopt@^3.0.6:
version "3.0.6"
resolved "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9"
Expand Down Expand Up @@ -14334,11 +14294,6 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1:
dependencies:
ansi-regex "^5.0.1"

strip-ansi@~0.1.0:
version "0.1.1"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz#39e8a98d044d150660abe4a6808acf70bb7bc991"
integrity sha512-behete+3uqxecWlDAm5lmskaSaISA+ThQ4oNNBDTBJt0x2ppR6IPqfZNuj6BLaLJ/Sji4TPZlcRyOis8wXQTLg==

strip-bom@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"
Expand Down Expand Up @@ -15083,11 +15038,6 @@ underscore@>=1.8.3, underscore@^1.13.2:
resolved "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz#04786a1f589dc6c09f761fc5f45b89e935136441"
integrity sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==

underscore@~1.6.0:
version "1.6.0"
resolved "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz#8b38b10cacdef63337b8b24e4ff86d45aea529a8"
integrity sha512-z4o1fvKUojIWh9XuaVLUDdf86RQiq13AC1dmHbTpoyuu+bquHms76v16CjycCbec87J7z0k//SiQVk0sMdFmpQ==

undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
Expand Down
Loading