Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prettier and ESlint with pre-commit #37

Merged
merged 9 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = tab
insert_final_newline = true
max_line_length = 130
trim_trailing_whitespace = true

[*.md]
max_line_length = 130
trim_trailing_whitespace = true
27 changes: 27 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"airbnb-base"
],
"parserOptions": {
"ecmaVersion": 12
},
"rules": {
"indent": ["error", "tab"],
"no-tabs": ["error", { "allowIndentationTabs": true }],
"max-len": ["error", { "code": 130 }],
"no-var": "error",
"semi": "error",
"no-multi-spaces": "error",
"space-in-parens": "error",
"no-multiple-empty-lines": "error",
"prefer-const": "error",
"no-use-before-define": "error"
}
}

sandhyak-tech marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

lint-staged
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 2,
"arrowParens": "avoid"
}
47 changes: 30 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
{
"name": "hackerrank",
"version": "1.0.0",
"description": "Solutions for HackerRank Problems in Javascript.",
"main": "index.js",
"scripts": {
"test": "mocha --recursive",
"report": "nyc mocha --recursive"
},
"author": "",
"license": "ISC",
"dependencies": {
"chai": "^4.2.0",
"mocha": "^6.2.1"
},
"devDependencies": {
"nyc": "^14.1.1"
}
"name": "hackerrank",
"version": "1.0.0",
"description": "Solutions for HackerRank Problems in Javascript.",
"main": "index.js",
"scripts": {
"test": "mocha --recursive",
"report": "nyc mocha --recursive",
"prepare": "husky install"
},
"lint-staged": {
"*.js": [
"npx pretty-quick --staged",
"eslint --fix"
]
},
"author": "",
"license": "ISC",
"dependencies": {
"chai": "^4.2.0",
"mocha": "^6.2.1"
},
"devDependencies": {
"eslint": "7.32.0",
"eslint-config-airbnb-base": "14.2.1",
"eslint-plugin-import": "2.24.2",
"husky": "7.0.2",
"lint-staged": "11.2.1",
"nyc": "^14.1.1",
"prettier": "2.4.1"
}
}