-
-
Notifications
You must be signed in to change notification settings - Fork 153
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 "check-examples" should use parser given in eslint configuration #434
Comments
Have you looked yet at the README docs? |
I have - but I understood the section on configuring I'll admit that I didn't read the README word by word, so if there is an explanation that examples are linted against a fixed set of default rules ignoring the ambient eslint configuration, it should probably be more overt. Additionally, there might be a compounding issue at play here: only a subtree of my project is being linted with the babel parser and thus has a nested eslint config file... |
What |
While we could try to pick up the parser config by default, we are picking up the parser config when there is a (I can't seem to get an error by having a bad |
I see, thanks for the explanation. I've extended my eslint and json/check-examples config and have gotten rid of the unwanted error message. 👍 Still, this behaviour feels needlessly surprising. I wonder how many users actually code in one dialect but write JSDoc comments from the perspective of a (library?) consumer. Should a Typescript developer really be expected to write examples in ES5 syntax? |
Yes, I think it is a reasonable addition to add. There may be somewhat of a performance cost, however, in always checking the file system (the linter checks the file system, even while the file doesn't need to exist). (I suppose there could be an option to opt-out.) |
If the Linter instance can be cached and reused for identical |
…cript file (though with `md` extension for easier automated overriding); fixes gajus#434 Also ensures that `baseConfig` is treated as lower priority
…cript file (though with `md` extension for easier automated overriding); fixes gajus#434 Also ensures that `baseConfig` is treated as lower priority
…cript file (though with `md` extension for easier automated overriding); fixes gajus#434 Also ensures that `baseConfig` is treated as lower priority and exits faster if no `example` tag
…cript file (though with `md` extension for easier automated overriding); fixes gajus#434 Also ensures that `baseConfig` is treated as lower priority, exits faster if no `example` tag, and avoids retrieving file config if `eslintrcForExamples` is `false`
…cript file (though with `md` extension for easier automated overriding); fixes gajus#434 Also ensures that `baseConfig` is treated as lower priority, exits faster if no `example` tag, and avoids retrieving file config if `eslintrcForExamples` is `false`
…cript file (though with `md` extension for easier automated overriding); fixes gajus#434 Also ensures that `baseConfig` is treated as lower priority, exits faster if no `example` tag, and avoids retrieving file config if `eslintrcForExamples` is `false`
…cript file (though with `md` extension for easier automated overriding); fixes gajus#434 Also ensures that `baseConfig` is treated as lower priority, exits faster if no `example` tag, and avoids retrieving file config if `eslintrcForExamples` is `false`
…cript file (though with `md` extension for easier automated overriding); fixes gajus#434 Also ensures that `baseConfig` is treated as lower priority, exits faster if no `example` tag, and avoids retrieving file config if `eslintrcForExamples` is `false`
…cript file (though with `md` extension for easier automated overriding); fixes gajus#434 Also ensures that `baseConfig` is treated as lower priority, exits faster if no `example` tag, and avoids retrieving file config if `eslintrcForExamples` is `false`
…cript file (though with `md` extension for easier automated overriding); fixes #434 Also ensures that `baseConfig` is treated as lower priority, exits faster if no `example` tag, and avoids retrieving file config if `eslintrcForExamples` is `false`
🎉 This issue has been resolved in version 20.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hey @brettz9, my apologies. I would have loved to give feedback, but I'm out of the office until the 7th. 😉 But I'll definitely check out the new version! 👍 |
No worries! Hope it works well for ya.... |
I'm having a really hard time figuring this one out. I have a TypeScript file that I want to write TypeScript examples for. I always get this error: /**
* Extracts the internal data type `T` from a `ThunkHookTuple<T>`
*
* @example
* type RetailStoreHook = ThunkHookTuple<Array<RetailStore>>;
* type RetailStoreHookType = ThunkHookType<RetailStoreHook>; // Array<RetailStore>
*/
export type ThunkHookType<T> = T extends ThunkHookTuple<infer U> & [unknown, typeof FETCH_SUCCESS, undefined] ? U : never;
I've tried messing around with |
@dannyfritz : Please file a new issue. |
Linting source code with certain experimental features (e.g. static class properties via Babel and its
proposal-class-properties
plugin) can be achieved by using the Babel parser within eslint via babel-eslint. However, thecheck-examples
rule apparently does not use the configured parser and fails to lint@example
code fragments.Contrived and stripped example:
Eslint reports a single warning by jsdoc/check-examples:
@example error: Parsing error: Unexpected token =
.eslintrc.js:
babel-eslint-options.js:
The text was updated successfully, but these errors were encountered: