Skip to content

Commit

Permalink
fix: Improve linting speed (snapshot-labs#4142)
Browse files Browse the repository at this point in the history
* Fix lint

* Add extensions.json

* Remove lint on pre commit

* Remove precommit

* Add rushstack

* Add format and fix lint

* Test fix

* Fix

* Fix lint and format

* Throw error on format warnings

---------

Co-authored-by: Wan <[email protected]>
  • Loading branch information
samuveth and wa0x6e authored Aug 12, 2023
1 parent 3a9008d commit 9e072f3
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 15 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution');

module.exports = {
root: true,
env: {
Expand All @@ -8,7 +11,7 @@ module.exports = {
'plugin:vue/vue3-recommended',
'eslint:recommended',
'@vue/eslint-config-typescript/recommended',
'@vue/eslint-config-prettier',
'@vue/eslint-config-prettier/skip-formatting',
'.eslintrc-auto-import.json'
],
ignorePatterns: ['/node_modules/**/*.*'],
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ jobs:

- name: Install dependencies
run: yarn

- name: Build
run: yarn run build

- name: Format
run: yarn run format:check

- name: Lint
run: yarn run lint


3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ pnpm-debug.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
/.vscode/settings.json
/.vscode/vue.code-snippets

# Vitest

Expand Down
2 changes: 0 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
1 change: 0 additions & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"Vue.volar",
"Vue.vscode-typescript-vue-plugin",
"esbenp.prettier-vscode"
]
}
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,17 @@
"cypress:serve:build": "VITE_E2E=true vite build && npx http-server dist -p 8081",
"preinstall": "yarn run init-submodules",
"build": "vite build",
"lint": "eslint \"./src/*/**/*.{js,ts,vue,json}\" --fix",
"lint": "eslint \"*.{ts,js,vue,json}\" src/ cypress/ --ext .ts,.js,.vue,.json",
"lint:fix": "yarn lint --fix",
"format": "prettier \"*.{ts,js,vue,json}\" src/ cypress/ --ext .ts,.js,.vue,.json",
"format:check": "yarn format --check || exit 1",
"format:fix": "yarn format --write",
"postinstall": "patch-package && husky install",
"init-submodules": "git submodule update --init",
"test:unit": "vitest run",
"test:e2e": "start-server-and-test 'yarn cypress:serve:build' http-get://localhost:8081 'cypress run'",
"test:unit:coverage": "vitest run --coverage"
},
"lint-staged": {
"*.{js,ts,vue,json}": [
"eslint --fix",
"prettier --write"
]
},
"dependencies": {
"@adraffy/ens-normalize": "^1.9.4",
"@apollo/client": "^3.7.13",
Expand Down Expand Up @@ -74,6 +72,7 @@
},
"devDependencies": {
"@iconify-json/heroicons-outline": "^1.1.6",
"@rushstack/eslint-patch": "^1.3.3",
"@synthetixio/synpress": "^3.5.1",
"@tailwindcss/forms": "^0.5.3",
"@types/bluebird": "^3.5.38",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1611,6 +1611,11 @@
estree-walker "^2.0.2"
picomatch "^2.3.1"

"@rushstack/eslint-patch@^1.3.3":
version "1.3.3"
resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.3.3.tgz#16ab6c727d8c2020a5b6e4a176a243ecd88d8d69"
integrity sha512-0xd7qez0AQ+MbHatZTlI1gu5vkG8r7MYRUJAHPAHJBmGLs16zpkrpAVLvjQKQOqaXPDUBwOiJzNc00znHSCVBw==

"@safe-global/safe-apps-provider@^0.17.1":
version "0.17.1"
resolved "https://registry.yarnpkg.com/@safe-global/safe-apps-provider/-/safe-apps-provider-0.17.1.tgz#72df2a66be5343940ed505efe594ed3b0f2f7015"
Expand Down

0 comments on commit 9e072f3

Please sign in to comment.