-
Hi all, I'm in the process of moving to this linting option (currently using v8 of eslint and Prettier). Let's say I have a simple util file that contains the following: export function exampleFactory() {
function exampleFunction() {
return {
example: true
};
}
return {
exampleFunction
};
} When I run
I experience similar errors with my Vue composables, but I have got round those by creating a 'rule' for the folder:
Granted, I could add my |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Rule of thumb: if a rule doesn't make sense and you have 3 eslint-ignores for it, just disable it
If the rule doesn't work for you because you want to do exactly what it was made to prevent (in your case factory functions with inline function definitions) you don't need it Failexport function doFoo(foo) {
// Does not capture anything from the scope, can be moved to the outer scope
function doBar(bar) {
return bar === 'bar';
}
return doBar;
}
function doFoo(foo) {
const doBar = bar => {
return bar === 'bar';
};
} Passfunction doBar(bar) {
return bar === 'bar';
}
export function doFoo(foo) {
return doBar;
}
export function doFoo(foo) {
function doBar(bar) {
return bar === 'bar' && foo.doBar(bar);
}
return doBar;
} |
Beta Was this translation helpful? Give feedback.
-
@eneeio-nm this rule was killed in https://github.com/antfu/eslint-config/releases/tag/v3.5.0 |
Beta Was this translation helpful? Give feedback.
@eneeio-nm this rule was killed in https://github.com/antfu/eslint-config/releases/tag/v3.5.0