[
https://issues.apache.org/jira/browse/CB-12895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16054437#comment-16054437
]
ASF GitHub Bot commented on CB-12895:
-------------------------------------
Github user filmaj commented on the issue:
https://github.com/apache/cordova-android/pull/386
I think one more tweak would be good:
So by putting `root:true` into the spec/**/ directories' eslintrc files,
when eslint searches up the directory tree to find an eslintrc file, once it
finds the file, it'll stop searching further. eslint, however, supports
"cascading" or combining multiple config files into one. We can leverage this
to define one project-level eslintrc file in the root of the project dir, but
then also have additional eslintrc files in project subdirectories if there are
specific rules we want to apply per-directory.
So I think what we want to do is:
- have the project-root-directory-level eslintrc file specify `root:true`
- any subdirectory-level eslintrc files _not_ to specify `root:true`
- this would then cause eslint to apply the rules from subdirectories,
but keep going to search for further rules, and in our case, it would keep
going until it hit the project-root-directory-level eslintrc, apply those
rules, and because that one has `root:true`, stop there.
- additionally, in this repo, both the spec/e2e and spec/unit directories
need just a single additional rule: `env: jasmine: true`. So we could actually
put a single eslintrc file under `/spec/.eslintrc.yml` and have it contain only
the one `env: jasmine: true` rule. Since root is not set to true for the
`spec/.eslintrc.yml` file, it'll go up one more directory and apply the
project-level eslintrc.
> 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]