43081j / eslint-plugin-lit

lit-html support for ESLint
116 stars 21 forks source link

Add filename checks #121

Open RoXuS opened 2 years ago

RoXuS commented 2 years ago

Hey!

Thx for this plugin.

I suggest these 2 rules to check if the filename matches with lit class name and if the filename matches with element name.

43081j commented 2 years ago

i feel like if we do adopt these rules, they should probably exist as one to keep them well scoped to lit.

a rule such as "file name matches class name" could exist in another plugin, unrelated to lit, and cover what the file-name-matches-element-class rule does and more.

so maybe we have a naming convention rule which uses the element name if one is found, and the class name otherwise.

@stramel if you get time can i get your thoughts on this too. i dont want the rules to end up being too generic, enough that they're not really lit-specific.

RoXuS commented 2 years ago

I'm agree, theses rules should be one, I split them to allow more flexibility to the user.

So, I can regroup the rules to check class + element name + filename, if you prefer.

Maybe class should be optional in the rules? (element + filename OR class/element/filename).