From 3bb3ccc98b468380f6b403e4ad66a7999c5cc2c8 Mon Sep 17 00:00:00 2001 From: NateScarlet Date: Sun, 28 Apr 2019 18:31:57 +0800 Subject: [PATCH] chore: configure eslint --- .eslintignore | 1 + .eslintrc | 49 +++++++++++++++++++++++++++++++++++++++++ .vscode/extensions.json | 2 +- package.json | 4 +++- 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..796b96d1c --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +/build diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 000000000..7285c249f --- /dev/null +++ b/.eslintrc @@ -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" + } +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json index e6a1ddab3..62271a5d0 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -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": [] } diff --git a/package.json b/package.json index 5fca0067b..c575ca460 100644 --- a/package.json +++ b/package.json @@ -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",