Skip to content

Commit 9489afc

Browse files
authored
build: add linter and lint staged (#34)
* add lint staged * hello * allow linting of vue components * test linter * use husky instead of yorkie * another test * bring back some sanity
1 parent 29702d0 commit 9489afc

File tree

4 files changed

+491
-17
lines changed

4 files changed

+491
-17
lines changed

.eslintrc.cjs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
root: true,
3+
parser: 'vue-eslint-parser',
4+
parserOptions: {
5+
parser: '@typescript-eslint/parser',
6+
sourceType: 'module',
7+
},
8+
plugins: ['@typescript-eslint', 'no-only-tests'],
9+
rules: {
10+
'no-console': 'error',
11+
'no-debugger': 'error',
12+
'no-only-tests/no-only-tests': 'error',
13+
'no-unused-vars': 'off',
14+
},
15+
}

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn lint-staged

package.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"storybook:vue": "yarn workspace storybook-vue start --no-open",
3131
"build:css": "yarn workspace @cypress-design/css build",
3232
"build:icons": "yarn workspace @cypress-design/icon-registry build && yarn workspace @cypress-design/react-icon build:codegen && yarn workspace @cypress-design/vue-icon build:codegen",
33-
"postinstall": "yarn build:css && yarn build:icons",
33+
"postinstall": "yarn husky install && yarn build:css && yarn build:icons",
3434
"new:component": "hygen component new"
3535
},
3636
"dependencies": {
@@ -41,19 +41,33 @@
4141
"@rollup/plugin-node-resolve": "^13.2.1",
4242
"@rollup/plugin-sucrase": "^4.0.3",
4343
"@rollup/plugin-typescript": "^8.3.2",
44+
"@typescript-eslint/eslint-plugin": "^5.27.0",
45+
"@typescript-eslint/parser": "^5.27.0",
4446
"@vitejs/plugin-vue": "^2.3.1",
4547
"@vitejs/plugin-vue-jsx": "^1.3.9",
4648
"@vue/tsconfig": "^0.1.3",
4749
"axe-core": "^4.4.2",
4850
"concurrently": "^7.1.0",
4951
"cypress": "^10.0.1",
5052
"cypress-axe": "^0.14.0",
53+
"eslint": "^8.17.0",
54+
"eslint-plugin-no-only-tests": "^2.6.0",
5155
"execa": "^6.1.0",
56+
"husky": "^8.0.1",
5257
"hygen": "^6.2.0",
58+
"lint-staged": ">=10",
5359
"prettier": "^2.6.2",
5460
"rollup": "^2.70.2",
5561
"typescript": "~4.6.3",
5662
"vite": "^2.9.1",
63+
"vue-eslint-parser": "^9.0.2",
5764
"vue-tsc": "^0.33.9"
65+
},
66+
"lint-staged": {
67+
"*.{js,ts,jsx,tsx,vue}": "eslint --cache --fix",
68+
"*.{js,css,md}": "prettier --write"
69+
},
70+
"gitHooks": {
71+
"pre-commit": "lint-staged"
5872
}
5973
}

0 commit comments

Comments
 (0)