Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (file-name-matches-element): new rule #97

Merged
merged 1 commit into from
Jul 25, 2023
Merged

Conversation

43081j
Copy link
Owner

@43081j 43081j commented Jul 24, 2023

Enforces that the filename of a file containing a custom element matches its class name according to the configured conventions.

For example, the default is ['kebab', 'camel'] which means the following examples are true:

// valid filename: someElement.js
// invalid filename: some_element.js
class SomeElement extends HTMLElement {}

With matchDirectory: true set:

// valid filename: foo/bar/someElement.js
// valid filename: bar/someElement.js
// valid filename: fooBarSomeElement.js
// invalid filename: some_element.js
class FooBarSomeElement extends HTMLElement {}

cc @keithamus this was probably the most difficult one. its not a lot of logic but getting my head around the various nested pieces of logic took a while 馃槀

but its the last one! 馃帀

Enforces that the filename of a file containing a custom element matches
its class name according to the configured conventions.

For example, the default is `['kebab', 'camel']` which means the
following examples are true:

```ts
// valid filename: someElement.js
// invalid filename: some_element.js
class SomeElement extends HTMLElement {}
```

With `matchDirectory: true` set:

```ts
// valid filename: foo/bar/someElement.js
// valid filename: bar/someElement.js
// valid filename: fooBarSomeElement.js
// invalid filename: some_element.js
class FooBarSomeElement extends HTMLElement {}
```
Copy link
Collaborator

@keithamus keithamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@43081j 43081j merged commit e614caf into ce-next Jul 25, 2023
4 checks passed
@43081j 43081j deleted the ce-next-filenames branch July 25, 2023 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants