3

I am checking my Lightning Javascript code using Codacy.com a platform that checks my code quality on each commit. Codacy uses ESLint - the same tool that the Lightning CLI uses.

Codacy.com allows me use a custom rule set, defining which rules I want to include and exclude.

I am looking for a way to use the rules defined by the CLI using my standard ESLint.

Is there a way to extract the CLI rules?

3
  • 1
    Hi Robert, did you find out how to add the Lightning CLI rules to standard ESLint? Apr 5, 2018 at 16:42
  • Sorry but no. Would love to see you try again! Apr 5, 2018 at 17:11
  • Will keep you posted on what I find. Apr 5, 2018 at 20:05

2 Answers 2

2

Salesforce DX CLI adds 5 custom rules to eslint (aura-api, ecma-intrinsics, new-rule-template, secure-document and secure-window). Those 5 custom rules could be added to eslint by using project specific linting rules (https://github.com/eslint/eslint/issues/8769). However this would be out of scope for the project I'm currently working on.

Here is a .eslintrc.json I'm using for now with the same rules minus the custom rules: https://gist.github.com/tstachl/8270663f168d75e20e2de83470cee6ea

This is not perfect but good enough for us.

Update (04/24/18)

I created an eslint plugin to run the custom Salesforce DX rules. You can find it here: https://github.com/desklabs/eslint-plugin-sfdx

0

Its available in the below location in your machine where heroku is installed. Mine is a windows machine and it was available in the below path

C:\Users\ABC\AppData\Local\heroku\plugins\node_modules\salesforce-lightning-cli\rules. you can find all the js files here.

1
  • Ok, and how can I "get them into" my local ESLint? Apr 25, 2017 at 11:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .