[
https://issues.apache.org/jira/browse/CB-12895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16181774#comment-16181774
]
Audrey So commented on CB-12895:
--------------------------------
Will be adding eslint to cordova-js and also ignoring pkg/ directory. Also,
will need to ignore cordova.js files in android, ios, windows, and browser.
This is to address a problem was uncovered while adding eslint to cordova-js
repo. Issue was:
The pkg/ directory is ignored by github so it doesn’t get checked in b/c the
files are newly generated every time we run grunt compile. They get overwritten
next time grunt compile is run. When grunt is called and compiled, it calls a
generate function, which calls a bundle function. Here -->
https://github.com/apache/cordova-js/blob/master/tasks/lib/bundle.js#L80 All of
the output.push stuff is not compliant with eslint because of the indenting.
For instance, here in line 80, eslint does not like that (1) there is a
semi-colon in front of function and (2) `var PLATFORM_VERSION_BUILD_LABEL = '"
+ platformVersion + "';");` is not indented. and everything after that is not
indented properly then.
Solution: add cordova.js to all the platform repos eslintignore file and ignore
pkg directory for eslint in cordova-js repo
> Replace jshint with eslint in our tools + platforms
> ---------------------------------------------------
>
> Key: CB-12895
> URL: https://issues.apache.org/jira/browse/CB-12895
> Project: Apache Cordova
> Issue Type: Improvement
> Components: AllComponents
> Reporter: Steve Gill
> Assignee: Audrey So
> Priority: Minor
> Labels: cordova-next
>
> Based on this proposal
> https://github.com/cordova/cordova-discuss/pull/70#issuecomment-306649308
> JSHint does minimal checks and JSCS has been deprecated in favor of ESLint.
> +
> +I suggest to replace the current style checkers with ESLint. This allows to
> set much more strict styling rules than at at this moment.
> +
> +I recommend using a popular preset, such as
> [airbnb-base](https://www.npmjs.com/package/eslint-config-airbnb-base).
> Example configuration:
> +
> +```yaml
> +root: true
> +
> +extends: airbnb-base
> +```
> +
> +Many styling issues could be fixed by simply running:
> +
> +```
> +./node_modules/.bin/eslint --fix .
> +```
> +
> +
> +
> +Optionally the indent could be set to 4 instead of 2, because that's used
> in the current code base.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]