Help with the new custom ESlint rule #17702
-
Hi everyone, I am new to ESlint, i am trying to learn and author a new custom rule using ESlint below are the steps i am following to create but it seems to be not working as expected facing some difficulty in debugging the issue. Please help me with the same. Thanks. Custom Rule Def: I am authoring a new rule to identify the filenames in a directory and check wether the filename start with AK_ or not. If the file name doesn't start with AK_ then the rule should throw the error Steps to recreate: Step1: Created a new directory
Step2: Performed below command in the empty directory
Step3: Created the custom rule file with name 'ak-rule.js' in the same directory Step4: The custom rule code is as below
Step5: My package.json file look as below
Step6: Then i used command Step7: Then in one of the project directories i created a sample file with name that doesn't start with AK_ to test Step8: In that project directory i created a .eslintrc.json file as below
Step9: In the same project directory i ran the below command
But the above rule seems to be not working while testing that in a the project directory locally not receiving any output. Please guide me with this rule if incase i miss any step or any of the above rule configurations are wrong. Thanks for your time in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @allurisriakhil, you need to provide a starting point for your plugin, where you would include your custom rules in the https://eslint.org/docs/latest/extend/custom-rule-tutorial#step-7-bundle-the-custom-rule-in-a-plugin |
Beta Was this translation helpful? Give feedback.
Hi @allurisriakhil, you need to provide a starting point for your plugin, where you would include your custom rules in the
rules
object.https://eslint.org/docs/latest/extend/custom-rule-tutorial#step-7-bundle-the-custom-rule-in-a-plugin