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 ESLint support #37

Merged
merged 5 commits into from Jul 5, 2017
Merged

Add ESLint support #37

merged 5 commits into from Jul 5, 2017

Conversation

JGAntunes
Copy link
Contributor

This PR addresses #35. It works by addressing all the issues prettier isn't capable of, such as unused vars and so on - https://github.com/prettier/prettier#how-does-it-compare-to-eslint-or-tslint-stylelint.

The only issue with the current config is with the global variables defined under the test files. These files should be run under a jest env, which, right now, every package we define needs to set this up "manually" (using a local eslintrc file in the __tests__ folder or using a comment in the test file). The newest eslint already supports rules by glob patterns which will be pretty useful in this case, but airbnb plugins still lack support for it. It will just be a matter of updating later on.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 6cec62a on chore/eslint into c317d43 on master.

Copy link
Contributor

@foliveira foliveira left a comment

Choose a reason for hiding this comment

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

Given your comment:

every package we define needs to set this up "manually" (using a local eslintrc file in the tests folder or using a comment in the test file).

Can we add this to the templates that the CLI uses, so that when someone creates a new component via the CLI tool, the local eslintrc file and/or the comment in the test file get added during that process.

package.json Outdated
"eslint-config-prettier": "^2.3.0",
"eslint-plugin-import": "^2.6.1",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should you we fix the versions for these? This was something we started doing but seemed to have stopped with some later packages.

Copy link
Contributor

Choose a reason for hiding this comment

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

it's my preference :-)

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling cc90e21 on chore/eslint into c317d43 on master.

@fampinheiro
Copy link
Contributor

The comments were addressed and currently the only thing that is "bugging" me are the code climate complaints (that don't make any sense btw).

"react-native-web": "0.0.96"
},
"peerDependencies": {
"@storybook/react-native": "^3.1.6"
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be added to the template file on /.lib/cli/package-json.js. Don't forget to fix the version too

"react-test-renderer": "15.5.4",
"webpack": "2.6.1"
},
"dependencies": {
"react": "16.0.0-alpha.6",
"react-dom": "15.5.4",
"react-native": "0.44.2",
Copy link
Contributor

@foliveira foliveira Jul 5, 2017

Choose a reason for hiding this comment

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

Should be downgraded to "0.44.1" so that storybook(-native) keeps working. Check if the package.json template is correct (on version 0.44.1) and change it to that version if otherwise.

@foliveira
Copy link
Contributor

@fampinheiro @JGAntunes check my last comment on peerDependency and react-native

@foliveira
Copy link
Contributor

foliveira commented Jul 5, 2017

ESLing considers the .eslintrc file as a deprecated format (here). Can we change our rule file to one of the supported formats (either .js or .json).

If we want to make use of configuration cascading (which is supported ootb by .eslintrc), keep in mind that for .eslintrc.* files, ESLint will stop looking in parent folders once it finds a configuration with "root": true.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling a24573a on chore/eslint into c317d43 on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling b88ed52 on chore/eslint into 0b555d3 on master.

@foliveira foliveira merged commit 3d5f45b into master Jul 5, 2017
@foliveira foliveira deleted the chore/eslint branch July 5, 2017 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants