chore: configure eslint

This commit is contained in:
NateScarlet
2019-04-28 18:31:57 +08:00
parent b61e791eda
commit 3bb3ccc98b
4 changed files with 54 additions and 2 deletions

1
.eslintignore Normal file
View File

@@ -0,0 +1 @@
/build

49
.eslintrc Normal file
View File

@@ -0,0 +1,49 @@
{
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 5
},
"env": {
"browser": true,
"node": true
},
"globals": {
"gl": true,
"GL": true,
"LS": true,
"Uint8Array": true,
"Uint32Array": true,
"Float32Array": true,
"LGraphCanvas": true,
"LGraph": true,
"LGraphNode": true,
"LiteGraph": true,
"LGraphTexture": true,
"Mesh": true,
"Shader": true,
"enableWebGLCanvas": true,
"vec2": true,
"vec3": true,
"vec4": true,
"DEG2RAD": true,
"isPowerOfTwo": true,
"cloneCanvas": true,
"createCanvas": true,
"hex2num": true,
"colorToString": true,
"showElement": true,
"quat": true,
"AudioSynth": true,
"SillyClient": true
},
"rules": {
"no-console": "off",
"no-empty": "warn",
"no-redeclare": "warn",
"no-inner-declarations": "warn",
"no-constant-condition": "warn",
"no-unused-vars": "warn",
"no-mixed-spaces-and-tabs": "warn",
"no-unreachable": "warn"
}
}

View File

@@ -3,7 +3,7 @@
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": ["esbenp.prettier-vscode"],
"recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}

View File

@@ -12,7 +12,9 @@
"build": "grunt build",
"start": "nodemon utils/server.js",
"test": "echo \"Error: no test specified\" && exit 1",
"prettier": "npx prettier --write src/**/*.* css/**/*.*"
"prettier": "npx prettier --write src/**/*.* css/**/*.*",
"lint": "npx eslint src",
"lint:fix": "npx eslint --fix src"
},
"repository": {
"type": "git",