Add Prettier configuration (#1346)

This commit is contained in:
Oscar Hinton 2021-12-17 15:44:44 +01:00 committed by GitHub
parent 595722dfa1
commit 2b0a9d995e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 854 additions and 14 deletions

View File

@ -12,7 +12,7 @@ insert_final_newline = true
[*.{js,ts,scss,html}] [*.{js,ts,scss,html}]
charset = utf-8 charset = utf-8
indent_style = space indent_style = space
indent_size = 4 indent_size = 2
[*.{ts}] [*.{ts}]
quote_type = single quote_type = single

View File

@ -388,8 +388,8 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Run linter # - name: Run linter
run: npm run lint # run: npm run lint
- name: NPM build - name: NPM build
run: npm run build:bit:cloud run: npm run build:bit:cloud

4
.husky/pre-commit Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged

10
.prettierignore Normal file
View File

@ -0,0 +1,10 @@
# Build directories
build
dist
jslib
# External libraries / auto synced locales
src/locales
src/404/*.min.css
src/scripts/u2f.js

3
.prettierrc.json Normal file
View File

@ -0,0 +1,3 @@
{
"printWidth": 100
}

823
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,9 @@
"deploy": "npm run dist:bit && gh-pages -d build", "deploy": "npm run dist:bit && gh-pages -d build",
"deploy:dev": "npm run dist:bit && gh-pages -d build -r git@github.com:kspearrin/bitwarden-web-dev.git", "deploy:dev": "npm run dist:bit && gh-pages -d build -r git@github.com:kspearrin/bitwarden-web-dev.git",
"lint": "tslint 'src/**/*.ts' 'bitwarden_license/src/**/*.ts'", "lint": "tslint 'src/**/*.ts' 'bitwarden_license/src/**/*.ts'",
"lint:fix": "tslint 'src/**/*.ts' 'bitwarden_license/src/**/*.ts' --fix" "lint:fix": "tslint 'src/**/*.ts' 'bitwarden_license/src/**/*.ts' --fix",
"prettier": "prettier --write .",
"prepare": "husky install"
}, },
"devDependencies": { "devDependencies": {
"@angular/compiler-cli": "^12.2.13", "@angular/compiler-cli": "^12.2.13",
@ -48,7 +50,10 @@
"html-loader": "^3.0.1", "html-loader": "^3.0.1",
"html-webpack-injector": "1.1.4", "html-webpack-injector": "1.1.4",
"html-webpack-plugin": "^5.5.0", "html-webpack-plugin": "^5.5.0",
"husky": "^7.0.4",
"lint-staged": "^12.1.2",
"mini-css-extract-plugin": "^2.4.5", "mini-css-extract-plugin": "^2.4.5",
"prettier": "2.5.1",
"process": "^0.11.10", "process": "^0.11.10",
"sass": "^1.32.10", "sass": "^1.32.10",
"sass-loader": "^12.4.0", "sass-loader": "^12.4.0",
@ -94,5 +99,8 @@
"engines": { "engines": {
"node": "~16", "node": "~16",
"npm": "~8" "npm": "~8"
},
"lint-staged": {
"*.{js,ts,css,scss,md}": "prettier --write"
} }
} }

View File

@ -27,7 +27,7 @@
<div class="row align-items-center"> <div class="row align-items-center">
<div class="col brand"> <div class="col brand">
<i class="fa fa-shield"></i>&nbsp; <i class="fa fa-shield"></i>&nbsp;
<strong>bit</strong>warden</span> <strong>bit</strong>warden
</div> </div>
</div> </div>
</div> </div>

View File

@ -38,7 +38,6 @@
"object-literal-sort-keys": false, "object-literal-sort-keys": false,
"object-literal-shorthand": [ true, "never" ], "object-literal-shorthand": [ true, "never" ],
"prefer-for-of": false, "prefer-for-of": false,
"quotemark": [ true, "single" ],
"whitespace": [ "whitespace": [
true, true,
"check-branch", "check-branch",
@ -50,10 +49,6 @@
"check-type" "check-type"
], ],
"max-classes-per-file": false, "max-classes-per-file": false,
"semicolon": [
true,
"always"
],
"trailing-comma": [ "trailing-comma": [
true, true,
{ {
@ -67,9 +62,6 @@
} }
], ],
"ordered-imports": true, "ordered-imports": true,
"arrow-parens": [ "arrow-parens": [true]
true,
"ban-single-arg-parens"
]
} }
} }