Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

[New rule] App structure #744

Open
NickBalnaves opened this issue Mar 19, 2022 · 0 comments
Open

[New rule] App structure #744

NickBalnaves opened this issue Mar 19, 2022 · 0 comments
Assignees
Labels
area-rules type: enhancement New feature or request

Comments

@NickBalnaves
Copy link

NickBalnaves commented Mar 19, 2022

Please describe what the rule should do:
Many projects follow directory naming conventions, file naming conventions and conventions for the type of content in that file. It can be quite common to accidentally make typos in file names or for newcomers to an existing project to not follow existing conventions.

A rule should be able to define the project structure for the directory and file names with a wildcard option. It should also be able to define the contents of that file, for example a file with the directory structure of /pages/*/example_page.dart should contain a class named ExamplePage which must use a StatelessWidget. This rule would take the "example" prefix from the file and match that to what the class name should be. If the page was created as /pages/examples/example.dart then this would be an error as it does not end in _page. Another example could be that the domain/*/*_repository.dart always contains only an abstract class.

It would be nice if this rule could handle a monorepo structure as well.

If your rule is inspired by other please provide link to it:
https://www.npmjs.com/package/eslint-plugin-folders
https://www.npmjs.com/package/eslint-plugin-filenames
https://www.npmjs.com/package/eslint-plugin-check-file
Dart code metrics ban name rule which blocks names from being used. Could be extended for a directory only.
Dart code metrics tag name rule which matches a variable name to a particular pattern. Might be able to be extended to work with everything else that isn't a variable like class names.

What category of rule is this? (place an "X" next to just one item)
[ ] Warns about a potential error (problem)
[x] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)

Are you willing to submit a pull request to implement this rule?
No

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-rules type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants