Added ESLint and Prettier.

This commit is contained in:
Sebastian Kupke 2019-07-16 13:54:04 +02:00
parent 1f5df65c48
commit 87b63c2142
6 changed files with 966 additions and 41 deletions

32
.eslintrc Normal file
View File

@ -0,0 +1,32 @@
{
"parserOptions": {
"ecmaVersion": 10,
"sourceType": "module",
"ecmaFeatures": {
"impliedStrict": true
}
},
"env": {
"browser": true,
"es6": true,
"node": true,
"jquery": true,
"worker": true,
"mocha": true,
"serviceworker": true
},
"globals": {
"PIXI": false,
"TweenLite": false,
"TweenMax": false,
"TimelineLite": false,
"TimelineMax": false,
"d3": false,
"SystemJS": false,
"app": true
},
"plugins": [
"prettier"
],
"extends": ["eslint:recommended", "plugin:prettier/recommended"]
}

View File

@ -1,35 +0,0 @@
{
"parserOptions": {
"ecmaVersion": 10,
"sourceType": "module",
"ecmaFeatures": {
"impliedStrict": true
}
},
"plugins": [
"mocha"
],
"env": {
"browser": true,
"es6": true,
"node": true,
"jquery": true
},
"globals": {
"PIXI": false,
"TweenLite": false,
"TweenMax": false,
"TimelineLite": false,
"TimelineMax": false,
"SystemJS": false
},
"extends": "eslint:recommended",
"rules": {
"semi": ["error", "never"],
"quotes": ["warn", "single", {"allowTemplateLiterals": true}],
"no-console": "warn",
"no-unused-vars": ["warn", {"argsIgnorePattern": "^(e|event|points|ended)$"}],
"indent": ["warn", 4, {"SwitchCase": 1}],
"mocha/no-exclusive-tests": "error"
}
}

6
.prettierrc Normal file
View File

@ -0,0 +1,6 @@
{
"singleQuote": true,
"jsxSingleQuote": true,
"tabWidth": 4,
"semi": false
}

View File

@ -9,11 +9,15 @@ export class IApp extends Interface {
/** Build the app by registering event handlers, /** Build the app by registering event handlers,
* adding DOM elements, instanciating templates, etc... * adding DOM elements, instanciating templates, etc...
*/ */
setup() { return this } setup() {
return this
}
/** Run the application by starting a main loop, ... /** Run the application by starting a main loop, ...
*/ */
run() { return this } run() {
return this
}
} }
export default class App extends Object { export default class App extends Object {
@ -48,8 +52,7 @@ export default class App extends Object {
this.allTests() this.allTests()
var end = performance.now() var end = performance.now()
return ['ok', end - start] return ['ok', end - start]
} } catch (e) {
catch(e) {
console.trace() console.trace()
return ['Tests failed', e.message] return ['Tests failed', e.message]
} }

915
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,11 +21,15 @@
"license": "LGPL-3.0-or-later", "license": "LGPL-3.0-or-later",
"devDependencies": { "devDependencies": {
"@pixi/jsdoc-template": "^2.4.2", "@pixi/jsdoc-template": "^2.4.2",
"eslint": "^6.0.1",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-prettier": "^3.1.0",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-concat": "^2.6.1", "gulp-concat": "^2.6.1",
"gulp-rename": "^1.4.0", "gulp-rename": "^1.4.0",
"gulp-replace": "^1.0.0", "gulp-replace": "^1.0.0",
"gulp-uglify": "^3.0.2" "gulp-uglify": "^3.0.2",
"prettier": "^1.18.2"
}, },
"dependencies": { "dependencies": {
"fs-extra": "^8.0.1", "fs-extra": "^8.0.1",