Skip to content

Commit

Permalink
formatting setup
Browse files Browse the repository at this point in the history
* add pre-commit hooks to lint stage files
* prettier setup
* eslint setup
  • Loading branch information
chmelevskij committed Jan 15, 2023
1 parent 4412000 commit ad05ecc
Show file tree
Hide file tree
Showing 11 changed files with 434 additions and 48 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120

[*.{yml,yaml}]
indent_size = 2
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.json
*.html
*.less
*.css
package.json
16 changes: 9 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
ecmaVersion: 2020,
sourceType: "module",
},
extends: ["plugin:vue/recommended"],
extends: ["plugin:vue/recommended", "prettier"],
env: {
node: true,
jquery: true,
Expand All @@ -12,13 +12,15 @@ module.exports = {
webextensions: true,
},
rules: {
"no-trailing-spaces": "error",
"eol-last": "error",
semi: "error",
"no-extra-semi": "error",
"comma-dangle": ["error", "always-multiline"],
"no-var": "error",
"prefer-template": "error",
"template-curly-spacing": "error",
"comma-dangle": ["error", "always-multiline"],
indent: [
"error",
4,
{
SwitchCase: 1,
},
],
},
};
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ cordova/bundle.keystore
.DS_store

# artefacts for Visual Studio Code
/.vscode/
.vscode/*
!.vscode/extensions.json

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

npx lint-staged
7 changes: 7 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"**/*.{js,vue}": [
"prettier --write --ignore-unknown",
"eslint --fix --ext .js,.vue"
],
"**/*.{less,css}": ["prettier --write --ignore-unknown"]
}
34 changes: 34 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# node.js npm related

node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Configurator Build process
cache/
apps/
dist/
dist_cordova/
debug/
release/
testresults/
.eslintcache
cordova/bundle.keystore

# OSX
.DS_store

# artefacts for Visual Studio Code
/.vscode/

# NetBeans
nbproject/

# IntelliJ
.idea

# Eclipse
.project
.settings/
test-results-junit/
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"esbenp.prettier-vscode"
]
}
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
"pretest": "yarn run lint",
"test": "vitest",
"lint": "eslint --ext .js,.vue src gulpfile.js gulp-appdmg.js",
"lint:fix": "eslint --fix src gulpfile.js gulp-appdmg.js",
"storybook": "start-storybook -p 6006"
"lint:fix": "eslint --ext .js,.vue --fix src gulpfile.js gulp-appdmg.js",
"format": "prettier --write {src,test}/**/*.{js,vue,css,less}",
"storybook": "start-storybook -p 6006",
"prepare": "husky install"
},
"window": {
"icon": "images/bf_icon_128.png",
Expand Down Expand Up @@ -97,6 +99,7 @@
"cordova-lib": "^11.0.0",
"del": "^6.1.1",
"eslint": "^8.24.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-vue": "^7.3.0",
"follow-redirects": "^1.15.2",
"fs-extra": "^10.1.0",
Expand All @@ -113,10 +116,12 @@
"gulp-xml-transformer": "^5.1.1",
"gulp-yarn": "^3.0.0",
"gulp-zip": "^5.1.0",
"husky": "^4.3.0",
"husky": "^8.0.2",
"lint-staged": "^13.1.0",
"nw-builder": "^3.8.6",
"os": "^0.1.2",
"postcss": "^8.4.17",
"prettier": "2.8.1",
"rollup": "^3.9.0",
"rollup-plugin-vue": "^5.*.*",
"rpm-builder": "^1.2.1",
Expand All @@ -140,4 +145,4 @@
"pre-commit": "yarn lint"
}
}
}
}
Loading

0 comments on commit ad05ecc

Please sign in to comment.