-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rule Proposal: export-style #637
Comments
Does #712 cover this? |
#712 Covers the second style but not the first I think. |
Could you explain the value in enforcing either style? (I’m not a fan of #712’s rule personally) |
So I've seen some people prefering all export statements at the end of the file and only exporting the variables / functions which are defined previously. This style is covered by #712 and #632. The advantage of this style is that when you open a file you know that you can see everything that's exported by the file at the end of the file. Personally I prefer to have the export statements in front of the variable / function declaration because then I can quickly see that a function is also needed outside of the file and I have to care about the integration outside of the file as well. Hopefully this explains the value of either style. |
So, to clarify: you want a rule that will enforce that everything exported is initialized as part of the export statement? If so, that would prevent re-exporting anything that was imported, would it not? |
So we have the current convention in our code: // if you can export something directly export it directly
export const foo = 'hello'
export function bar() {}
export default function baz() {}
// if you can't export it directly have the export statement directly after the declaration
const foo = 'hello'
export default foo So this rule should be only enforced when it's possible to write everthing together. |
I'm not convinced yet either way, but I am definitely leaning towards it not being something that makes sense for this plugin. |
Hey,
while working on #632 / #620 I was thinking about a new rule.
The rule would lint the style of the export statements. There are 2 styles which I think would be good options.
and
I think that would be a great addition to #632 / #620.
What are you thoughts about this rule?
The text was updated successfully, but these errors were encountered: