[EC-183] Move eslint and prettier to project root (#2536)

This commit is contained in:
Oscar Hinton 2022-05-03 21:45:37 +02:00 committed by GitHub
parent 06f72b90d7
commit c1cc5a0814
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 5258 additions and 2144 deletions

9
.eslintignore Normal file
View File

@ -0,0 +1,9 @@
**/build
**/jslib
**/webpack.config.js
**/karma.conf.js
**/gulpfile.js
apps/browser/src/content/autofill.js
apps/browser/src/scripts/duo.js
**/node_modules

55
.eslintrc.json Normal file
View File

@ -0,0 +1,55 @@
{
"root": true,
"env": {
"browser": true,
"webextensions": true
},
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier"
],
"rules": {
"@typescript-eslint/no-explicit-any": "off", // TODO: This should be re-enabled
"@typescript-eslint/no-unused-vars": ["warn", { "args": "none" }],
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "no-public"
}
],
"@typescript-eslint/no-this-alias": [
"error",
{
"allowedNames": ["self"]
}
],
"no-console": "warn",
"import/no-unresolved": "off", // TODO: Look into turning off once each package is an actual package.
"import/order": [
"error",
{
"alphabetize": {
"order": "asc"
},
"newlines-between": "always",
"pathGroups": [
{
"pattern": "jslib-*/**",
"group": "external",
"position": "after"
},
{
"pattern": "src/**/*",
"group": "parent",
"position": "before"
}
],
"pathGroupsExcludedImportTypes": ["builtin"]
}
]
}
}

View File

@ -7,7 +7,7 @@ on:
- 'l10n_master'
- 'gh-pages'
paths:
- 'apps/browser'
- 'apps/browser/**'
workflow_dispatch:
inputs: {}
@ -33,26 +33,6 @@ jobs:
run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git
lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3.0.0
- name: Set up Node
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
- name: Run linter
run: |
npm ci
npm run lint
setup:
name: Setup
runs-on: ubuntu-20.04

View File

@ -7,7 +7,7 @@ on:
- 'l10n_master'
- 'gh-pages'
paths:
- 'apps/desktop'
- 'apps/desktop/**'
workflow_dispatch:
inputs: {}

36
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,36 @@
---
name: Lint
on:
push:
branches-ignore:
- 'l10n_master'
- 'gh-pages'
paths-ignore:
- '.github/workflows/**'
workflow_dispatch:
inputs: {}
defaults:
run:
shell: bash
jobs:
lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3.0.0
- name: Set up Node
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16'
- name: Run linter
run: |
npm ci
npm run lint

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/

1
.husky/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
_

4
.husky/pre-commit Normal file
View File

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

15
.prettierignore Normal file
View File

@ -0,0 +1,15 @@
# Build directories
**/build
**/dist
**/coverage
**/jslib
# External libraries / auto synced locales
apps/browser/src/_locales
apps/browser/src/scripts/duo.js
apps/browser/src/content/autofill.js
apps/browser/src/safari
# Github Workflows
.github/workflows

View File

@ -1,9 +0,0 @@
**/build
jslib
webpack.config.js
karma.conf.js
gulpfile.js
src/content/autofill.js
src/scripts/duo.js
**/node_modules

View File

@ -1,32 +0,0 @@
{
"root": true,
"env": {
"browser": true,
"webextensions": true
},
"extends": ["./jslib/shared/eslintrc.json"],
"rules": {
"import/order": [
"error",
{
"alphabetize": {
"order": "asc"
},
"newlines-between": "always",
"pathGroups": [
{
"pattern": "jslib-*/**",
"group": "external",
"position": "after"
},
{
"pattern": "src/**/*",
"group": "parent",
"position": "before"
}
],
"pathGroupsExcludedImportTypes": ["builtin"]
}
]
}
}

View File

@ -1,15 +0,0 @@
# Build directories
build
dist
coverage
jslib
# External libraries / auto synced locales
src/_locales
src/scripts/duo.js
src/content/autofill.js
src/safari
# Github Workflows
.github/workflows

View File

@ -1,4 +1,4 @@
[![Github Workflow build on master](https://github.com/bitwarden/browser/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/bitwarden/browser/actions/workflows/build.yml?query=branch:master)
[![Github Workflow build browser on master](https://github.com/bitwarden/bitwarden/actions/workflows/build-browser.yml/badge.svg?branch=master)](https://github.com/bitwarden/bitwarden/actions/workflows/build-browser.yml?query=branch:master)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/bitwarden-browser/localized.svg)](https://crowdin.com/project/bitwarden-browser)
[![Join the chat at https://gitter.im/bitwarden/Lobby](https://badges.gitter.im/bitwarden/Lobby.svg)](https://gitter.im/bitwarden/Lobby)

File diff suppressed because it is too large Load Diff

View File

@ -21,11 +21,8 @@
"dist:safari:mas": "npm run build:prod && gulp dist:safari:mas",
"dist:safari:masdev": "npm run build:prod && gulp dist:safari:masdev",
"dist:safari:dmg": "npm run build:prod && gulp dist:safari:dmg",
"lint": "eslint . && prettier --check .",
"lint:fix": "eslint . --fix",
"test": "karma start --single-run",
"test:watch": "karma start",
"prettier": "prettier --write ."
"test:watch": "karma start"
},
"devDependencies": {
"@angular/compiler-cli": "^12.2.13",
@ -35,18 +32,12 @@
"@types/jasmine": "^3.7.6",
"@types/mousetrap": "^1.6.8",
"@types/node": "^16.11.12",
"@typescript-eslint/eslint-plugin": "^5.12.1",
"@typescript-eslint/parser": "^5.12.1",
"buffer": "^6.0.3",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^10.0.0",
"cross-env": "^7.0.3",
"css-loader": "^6.5.1",
"del": "^6.0.0",
"eslint": "^8.9.0",
"eslint-config-prettier": "^8.4.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-plugin-import": "^2.25.4",
"gulp": "^4.0.2",
"gulp-filter": "^7.0.0",
"gulp-if": "^3.0.0",

5097
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

36
package.json Normal file
View File

@ -0,0 +1,36 @@
{
"name": "@bitwarden/bitwarden",
"version": "0.0.0",
"description": "Bitwarden Client Applications",
"repository": {
"type": "git",
"url": "git+https://github.com/bitwarden/bitwarden.git"
},
"author": "Bitwarden Inc. <hello@bitwarden.com> (https://bitwarden.com)",
"license": "GPL-3.0",
"bugs": {
"url": "https://github.com/bitwarden/bitwarden/issues"
},
"homepage": "https://bitwarden.com",
"scripts": {
"lint": "eslint . && prettier --check .",
"lint:fix": "eslint . --fix",
"prettier": "prettier --write .",
"prepare": "husky install"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.22.0",
"@typescript-eslint/parser": "^5.22.0",
"eslint": "^8.14.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^2.7.1",
"eslint-plugin-import": "^2.26.0",
"husky": "^7.0.4",
"lint-staged": "^12.4.1",
"prettier": "^2.6.2"
},
"lint-staged": {
"./!(**/jslib)**": "prettier --ignore-unknown --write",
"*.ts": "eslint --fix"
}
}