Skip to content

Commit 3dab272

Browse files
kaizhu256kai.zhu
andauthored
lint file .eslintrc.js (#380)
* - eslint - lint file .eslintrc.js - eslint - add eslint rule "comma-dangle": ["error", "never"] - eslint - add npm-command prettify to autofix minor whitespace-errors - Change formatting in src/api.js Co-authored-by: kai.zhu <[email protected]>
1 parent 4d742f2 commit 3dab272

File tree

3 files changed

+48
-39
lines changed

3 files changed

+48
-39
lines changed

.eslintrc.js

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,47 @@
11
module.exports = {
2-
env: {
3-
browser: true,
4-
es6: true,
5-
node: true,
6-
},
7-
extends: [
8-
'airbnb-base',
9-
],
10-
globals: {
11-
Atomics: 'readonly',
12-
SharedArrayBuffer: 'readonly',
13-
},
14-
parserOptions: {
15-
ecmaVersion: 5,
16-
sourceType: "script",
17-
},
18-
rules: {
19-
"strict": ["error", "function"],
20-
"no-cond-assign": ["error", "except-parens"],
21-
"no-var": "off",
22-
"vars-on-top": "off",
23-
"prefer-destructuring": "off",
24-
"prefer-spread": "off",
25-
"prefer-template": "off",
26-
"prefer-arrow-callback": "off",
27-
"comma-dangle": "off",
28-
"object-shorthand": "off",
29-
"no-throw-literal": "off",
30-
"no-param-reassign": "off",
31-
"no-bitwise": "off",
32-
"camelcase": "off",
33-
"dot-notation": "off",
34-
"indent": ["error", 4, { "SwitchCase": 1 }],
35-
"quotes": ["error", "double"],
36-
},
2+
env: {
3+
browser: true,
4+
es6: true,
5+
node: true
6+
},
7+
extends: [
8+
"airbnb-base"
9+
],
10+
globals: {
11+
Atomics: "readonly",
12+
SharedArrayBuffer: "readonly"
13+
},
14+
ignorePatterns: [
15+
"/dist/",
16+
"/examples/",
17+
"/node_modules/",
18+
"/out/",
19+
"/src/shell-post.js",
20+
"/src/shell-pre.js",
21+
"/test/",
22+
"!/.eslintrc.js"
23+
],
24+
parserOptions: {
25+
ecmaVersion: 5,
26+
sourceType: "script"
27+
},
28+
rules: {
29+
camelcase: "off",
30+
"comma-dangle": "off",
31+
"dot-notation": "off",
32+
indent: ["error", 4, { SwitchCase: 1 }],
33+
"no-bitwise": "off",
34+
"no-cond-assign": ["error", "except-parens"],
35+
"no-param-reassign": "off",
36+
"no-throw-literal": "off",
37+
"no-var": "off",
38+
"object-shorthand": "off",
39+
"prefer-arrow-callback": "off",
40+
"prefer-destructuring": "off",
41+
"prefer-spread": "off",
42+
"prefer-template": "off",
43+
quotes: ["error", "double"],
44+
strict: ["error", "function"],
45+
"vars-on-top": "off"
46+
}
3747
};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"build": "make",
2323
"rebuild": "make clean && make",
2424
"test": "npm run lint && npm run test-asm && npm run test-asm-debug && npm run test-wasm && npm run test-wasm-debug && npm run test-asm-memory-growth",
25-
"lint": "eslint src/api.js src/worker.js",
25+
"lint": "eslint .",
26+
"prettify": "eslint . --fix",
2627
"test-asm": "node test/all.js asm",
2728
"test-asm-debug": "node test/all.js asm-debug",
2829
"test-asm-memory-growth": "node test/all.js asm-memory-growth",

src/api.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -864,9 +864,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
864864
Object.values(this.functions).forEach(removeFunction);
865865
this.functions = {};
866866
this.handleError(sqlite3_close_v2(this.db));
867-
binaryDb = FS.readFile(this.filename, {
868-
encoding: "binary",
869-
});
867+
binaryDb = FS.readFile(this.filename, { encoding: "binary" });
870868
this.handleError(sqlite3_open(this.filename, apiTemp));
871869
this.db = getValue(apiTemp, "i32");
872870
return binaryDb;

0 commit comments

Comments
 (0)