Skip to content

Commit

Permalink
lint file .eslintrc.js (#380)
Browse files Browse the repository at this point in the history
* - 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 <kai.zhu@windebt.com>
  • Loading branch information
kaizhu256 and kai.zhu authored Apr 4, 2020
1 parent 4d742f2 commit 3dab272
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 39 deletions.
80 changes: 45 additions & 35 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,47 @@
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
extends: [
'airbnb-base',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parserOptions: {
ecmaVersion: 5,
sourceType: "script",
},
rules: {
"strict": ["error", "function"],
"no-cond-assign": ["error", "except-parens"],
"no-var": "off",
"vars-on-top": "off",
"prefer-destructuring": "off",
"prefer-spread": "off",
"prefer-template": "off",
"prefer-arrow-callback": "off",
"comma-dangle": "off",
"object-shorthand": "off",
"no-throw-literal": "off",
"no-param-reassign": "off",
"no-bitwise": "off",
"camelcase": "off",
"dot-notation": "off",
"indent": ["error", 4, { "SwitchCase": 1 }],
"quotes": ["error", "double"],
},
env: {
browser: true,
es6: true,
node: true
},
extends: [
"airbnb-base"
],
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly"
},
ignorePatterns: [
"/dist/",
"/examples/",
"/node_modules/",
"/out/",
"/src/shell-post.js",
"/src/shell-pre.js",
"/test/",
"!/.eslintrc.js"
],
parserOptions: {
ecmaVersion: 5,
sourceType: "script"
},
rules: {
camelcase: "off",
"comma-dangle": "off",
"dot-notation": "off",
indent: ["error", 4, { SwitchCase: 1 }],
"no-bitwise": "off",
"no-cond-assign": ["error", "except-parens"],
"no-param-reassign": "off",
"no-throw-literal": "off",
"no-var": "off",
"object-shorthand": "off",
"prefer-arrow-callback": "off",
"prefer-destructuring": "off",
"prefer-spread": "off",
"prefer-template": "off",
quotes: ["error", "double"],
strict: ["error", "function"],
"vars-on-top": "off"
}
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"build": "make",
"rebuild": "make clean && make",
"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",
"lint": "eslint src/api.js src/worker.js",
"lint": "eslint .",
"prettify": "eslint . --fix",
"test-asm": "node test/all.js asm",
"test-asm-debug": "node test/all.js asm-debug",
"test-asm-memory-growth": "node test/all.js asm-memory-growth",
Expand Down
4 changes: 1 addition & 3 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -864,9 +864,7 @@ Module["onRuntimeInitialized"] = function onRuntimeInitialized() {
Object.values(this.functions).forEach(removeFunction);
this.functions = {};
this.handleError(sqlite3_close_v2(this.db));
binaryDb = FS.readFile(this.filename, {
encoding: "binary",
});
binaryDb = FS.readFile(this.filename, { encoding: "binary" });
this.handleError(sqlite3_open(this.filename, apiTemp));
this.db = getValue(apiTemp, "i32");
return binaryDb;
Expand Down

0 comments on commit 3dab272

Please sign in to comment.