Set up Prettier and eslint.
I (@benjamn) removed husky and made eslint run before tests, because I don't want any pre-commit hooks in this repository. I tend to use Git in ways that conflict with the assumptions these tools make.
This commit is contained in:
parent
07625f03ce
commit
bb58688f40
7 changed files with 1611 additions and 108 deletions
|
|
@ -1,2 +1,13 @@
|
|||
[*.js]
|
||||
[*]
|
||||
insert_final_newline = true
|
||||
|
||||
[{package.json}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[{*.js, *.ts}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
|
|
|
|||
16
.eslintrc.js
Normal file
16
.eslintrc.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
module.exports = {
|
||||
parser: "@typescript-eslint/parser",
|
||||
parserOptions: {
|
||||
ecmaVersion: 6,
|
||||
sourceType: "module",
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
"no-var": "error",
|
||||
"no-case-declarations": "error",
|
||||
"no-fallthrough": "error",
|
||||
},
|
||||
ignorePatterns: ["test/data"],
|
||||
};
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
# Ignore TypeScript-emitted files
|
||||
*.js
|
||||
!.*rc.js
|
||||
*.d.ts
|
||||
# Except...
|
||||
!/types/**/*.d.ts
|
||||
|
|
|
|||
1
.prettierignore
Normal file
1
.prettierignore
Normal file
|
|
@ -0,0 +1 @@
|
|||
**/*.d.ts
|
||||
14
.prettierrc.js
Normal file
14
.prettierrc.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
module.exports = {
|
||||
printWidth: 100,
|
||||
trailingComma: "all",
|
||||
singleQuote: false,
|
||||
|
||||
overrides: [
|
||||
{
|
||||
files: "*.md",
|
||||
options: {
|
||||
printWidth: 60,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
1660
package-lock.json
generated
1660
package-lock.json
generated
File diff suppressed because it is too large
Load diff
14
package.json
14
package.json
|
|
@ -24,12 +24,20 @@
|
|||
"scripts": {
|
||||
"mocha": "test/run.sh",
|
||||
"debug": "test/run.sh --inspect-brk",
|
||||
"test": "npm run build && npm run mocha",
|
||||
"test": "npm run lint && npm run build && npm run mocha",
|
||||
"build": "npm run clean && tsc",
|
||||
"lint": "eslint --ext .ts .",
|
||||
"format": "prettier --write '{lib,test}/**.ts' '*rc.js'",
|
||||
"clean": "ts-emit-clean",
|
||||
"prepack": "npm run build",
|
||||
"postpack": "npm run clean"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.ts": [
|
||||
"eslint",
|
||||
"prettier -c"
|
||||
]
|
||||
},
|
||||
"browser": {
|
||||
"fs": false
|
||||
},
|
||||
|
|
@ -47,10 +55,14 @@
|
|||
"@types/glob": "7.1.1",
|
||||
"@types/mocha": "5.2.7",
|
||||
"@types/node": "13.1.1",
|
||||
"@typescript-eslint/parser": "^3.0.1",
|
||||
"eslint": "^7.1.0",
|
||||
"esprima-fb": "15001.1001.0-dev-harmony-fb",
|
||||
"flow-parser": "0.119.1",
|
||||
"glob": "7.1.5",
|
||||
"lint-staged": "^10.2.6",
|
||||
"mocha": "6.2.2",
|
||||
"prettier": "^2.0.5",
|
||||
"reify": "0.20.12",
|
||||
"ts-emit-clean": "1.0.0",
|
||||
"ts-node": "7.0.1",
|
||||
|
|
|
|||
Loading…
Reference in a new issue