提交 d4addbbd 编写于 作者: F Félix Queiruga

Enables linting for JS and LESS files

- Uses eslint for JS and stylelint for LESS
- Uses default configs
- Default severity set to warn to avoid breaking current builds
上级 9c1ed195
module.exports = {
env: {
browser: true,
es6: true
},
// Uses eslint default ruleset
extends: "eslint:recommended",
plugins: [
// Keeps the default level to warn to avoid breaking the current
// CI build environment
"only-warn"
],
parserOptions: {
ecmaVersion: 2018,
sourceType: "module"
},
rules: {
},
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
'__dirname': false,
// Allow jest globals used in tests
jest: false,
expect: false,
it: false,
describe: false,
beforeEach: false,
afterEach: false,
beforeAll: false,
afterAll: false,
}
};
\ No newline at end of file
{
"curly": true,
"eqeqeq": true,
"unused": true,
"undef": true,
"browser": true,
"browserify": true,
"jasmine": true,
"esversion": 6,
"predef": ["console", "Hash"]
}
module.exports = {
extends: "stylelint-config-standard",
rules: {
indentation: null
},
// Keeps the default level to warn to avoid breaking the current
// CI build environment
defaultSeverity: "warning"
}
......@@ -14,7 +14,10 @@
"prod": "webpack --config webpack.config.js --mode=production",
"build": "yarn prod",
"start": "yarn copy-fonts && yarn dev --watch",
"test": "jest --config=jest.config.json"
"test": "jest --config=jest.config.json",
"lint:js": "eslint src/main/js src/test/js",
"lint:css": "stylelint src/main/less --syntax less",
"lint": "yarn lint:js && yarn lint:css"
},
"devDependencies": {
"@babel/cli": "^7.7.4",
......@@ -23,16 +26,18 @@
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.2.0",
"eslint": "^6.8.0",
"eslint-plugin-only-warn": "^1.0.2",
"file-loader": "^5.0.2",
"handlebars": "^3.0.3",
"handlebars-loader": "^1.7.1",
"jest": "^24.9.0",
"jest-handlebars": "^1.0.1",
"jest-standard-reporter": "^1.0.4",
"jshint": "^2.10.3",
"less": "^3.10.3",
"less-loader": "^5.0.0",
"mini-css-extract-plugin": "^0.8.0",
"stylelint-config-standard": "^19.0.0",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10",
"webpack-fix-style-only-entries": "^0.4.0"
......@@ -43,6 +48,7 @@
"bootstrap": "3.3.5",
"jenkins-js-modules": "^1.5.0",
"jquery": "2.1.4",
"stylelint": "^13.0.0",
"window-handle": "^1.0.0"
},
"browserslist": [
......
......@@ -667,6 +667,18 @@ THE SOFTWARE.
<skip>${skipTests}</skip>
</configuration>
</execution>
<execution>
<phase>test</phase>
<id>yarn lint</id>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>lint</arguments>
<skip>${skipTests}</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
......
......@@ -16,7 +16,7 @@ var getSetupWizardGui = function() {
return require('../../main/js/pluginSetupWizardGui').default;
}
/* globals defaultUpdateSiteId: true */
/* eslint-disable-next-line */
global.defaultUpdateSiteId = 'default';
// Iterates through all responses until the end and returns the last response repeatedly
......@@ -230,7 +230,7 @@ describe("pluginSetupWizard.js", function () {
});
it("wizard shows", function (done) {
test(function($) {
test(function() {
// Make sure the dialog was shown
var $wizard = $body.find('.plugin-setup-wizard');
expect($wizard.size()).toBe(1);
......@@ -284,7 +284,7 @@ describe("pluginSetupWizard.js", function () {
});
it("install defaults", function (done) {
test(function($) {
test(function() {
// Make sure the dialog was shown
var wizard = $body.find('.plugin-setup-wizard');
expect(wizard.size()).toBe(1);
......@@ -315,9 +315,9 @@ describe("pluginSetupWizard.js", function () {
trigger = 'change';
}
$el.trigger(trigger);
};
}
test(function($) {
test(function() {
$body.find('.install-custom').click();
// validate a call to installPlugins with our defaults
......@@ -381,7 +381,7 @@ describe("pluginSetupWizard.js", function () {
}
},
};
test(function($) {
test(function() {
expect($body.find('.install-done').size()).toBe(0);
expect($body.find('.install-done-restart').size()).toBe(0);
done();
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册