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

added eslint and prettier with husky #17

Merged
merged 1 commit into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.config*
node_modules
.rts2_cache_cjs
.rts2_cache_es
.rts2_cache_umd
dist
36 changes: 36 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
"env": {
"browser": true,
"es2021": true,
node: true,
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
'prettier'
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module",
"parser": '@typescript-eslint/parser'
},
"plugins": [
"react"
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-tabs': 'off',
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"no-undef": "off"
},
settings: {
react: {
version: 'detect'
}
}
};
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.config*
node_modules
.rts2_cache_cjs
.rts2_cache_es
.rts2_cache_umd
dist
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
bracketSpacing: true,
printWidth: 120,
singleQuote: true,
semi: false,
trailingComma: 'es5',
};
18 changes: 17 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"build": "next build",
"export": "yarn build && next export",
"start": "next start",
"lint": "eslint . --fix",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Expand All @@ -33,7 +34,22 @@
},
"devDependencies": {
"autoprefixer": "9.8.6",
"eslint": "^7.10.0",
"eslint-config-prettier": "^6.12.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.21.3",
"husky": "^4.3.0",
"lint-staged": "^10.4.0",
"prettier": "^2.1.2",
"rustywind": "0.6.6",
"tailwindcss": "1.7.2"
},
"lint-staged": {
"*.{js,ts,vue}": "yarn lint"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}
}
4 changes: 2 additions & 2 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function DaftarIsiPage() {

{babChild.children && babChild.children.length > 0 && (
<ol>
{babChild.children.map((li) => (
<li className="ml-4 text-orange-500">
{babChild.children.map((li, index) => (
<li key={index} className="ml-4 text-orange-500">
<Link href={li.href}>
<a title={li.text}>{li.text}</a>
</Link>
Expand Down
2 changes: 1 addition & 1 deletion pages/pancasila.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function PancasilaPage() {
</div>
<p>{PancasilaData.meaning.preface}</p>
<div className="mt-4">
{PancasilaData.meaning.data.map((section, index) => (
{PancasilaData.meaning.data.map((section) => (
<div
key={section}
className="mt-4 flex items-center rounded overflow-hidden shadow-lg"
Expand Down
Loading