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:
Conrad Buck 2020-05-25 13:18:30 -07:00 committed by Ben Newman
parent 07625f03ce
commit bb58688f40
No known key found for this signature in database
GPG key ID: 15D2E57778C1A4BF
7 changed files with 1611 additions and 108 deletions

View file

@ -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
View 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
View file

@ -5,6 +5,7 @@
# Ignore TypeScript-emitted files
*.js
!.*rc.js
*.d.ts
# Except...
!/types/**/*.d.ts

1
.prettierignore Normal file
View file

@ -0,0 +1 @@
**/*.d.ts

14
.prettierrc.js Normal file
View file

@ -0,0 +1,14 @@
module.exports = {
printWidth: 100,
trailingComma: "all",
singleQuote: false,
overrides: [
{
files: "*.md",
options: {
printWidth: 60,
},
},
],
};

1660
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -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",