Skip to content

Add eslint and editorconfig for linting and codestyle #568

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

Merged
merged 2 commits into from
May 22, 2017
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
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

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

[*.md]
trim_trailing_whitespace = false
26 changes: 26 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"env": {
"es6": true,
"node": true,
"browser": true
},
"extends": "eslint:recommended",
"installedESLint": true,
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
"react/jsx-uses-vars": 1,
"react/jsx-uses-react": 1,
"react/react-in-jsx-scope": 1,
"no-console": 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need that?

Copy link
Contributor Author

@JeremyPlease JeremyPlease Nov 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 3 rules fix some linting issues with react/jsx:

And no-console allows console.____ to be used without linting errors.

"no-case-declarations": 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that can be fixed by wrapping declarations inside cases within blocks (did it for parse-server)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't actually fix any linting errors. I noticed the no-case-declarations errors a lot so I disabled that rule.

}
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
"babel-polyfill": "^6.7.2",
"babel-runtime": "~5.8.25",
"css-loader": "~0.18.0",
"eslint": "^3.8.1",
"eslint-plugin-react": "^6.4.1",
"file-loader": "^0.8.5",
"history": "^2.1.2",
"http-server": "~0.8.5",
Expand Down Expand Up @@ -77,6 +79,7 @@
"pig": "http-server ./PIG -p 4041 -s & webpack --config webpack/PIG.config.js --progress --watch",
"build": "NODE_ENV=production webpack --config webpack/production.config.js && webpack --config webpack/PIG.config.js",
"test": "NODE_PATH=./node_modules jest",
"lint": "eslint . --ignore-path .gitignore --ignore-pattern *.test.js",
"generate": "node scripts/generate.js",
"prepublish": "webpack --config webpack/publish.config.js",
"start": "node ./Parse-Dashboard/index.js"
Expand Down