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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check-examples rule #119

Merged
merged 2 commits into from
Dec 9, 2018
Merged

check-examples rule #119

merged 2 commits into from
Dec 9, 2018

Conversation

brettz9
Copy link
Collaborator

@brettz9 brettz9 commented Dec 8, 2018

  • feat: Add check-examples rule to lint JavaScript within @example (fixes Full ESLint on JavaScript within @example #101);
    with settings to:
    1. require JSDoc-spec'd <caption> at beginning of @example
    2. regex settings to whitelist and blacklist lintable examples
    3. setting for a dummy file name to trigger specific rules defined in one's
      config; usable with ESLint overrides->files globs, to apply a desired
      subset of rules with @example (besides allowing for rules specific to
      examples, can be useful for using same rules within @example as
      with JavaScript Markdown lintable by other plugins)
    4. Other settings for specifying config (base config object or an .eslintrc
      config file; checks normal .eslintrc by default unless
      eslintrcForExamples setting is set to false)
    5. Provides some defaults for suppressing reporting of rules which are
      likely to be troublesome in example files unless
      noDefaultExampleRules setting is true
  • Report column (for checkExamples and any that report it)

Regarding your comment about being open to a PR but the need being esoteric, in my opinion, this could actually be the single most important doc item to lint for, in order to ensure the examples indicated for users of the library do not have inadvertent bugs.

Thanks!

@gajus
Copy link
Owner

gajus commented Dec 8, 2018

Looks good. Can you please contribute the documentation for this rule?

@brettz9 brettz9 force-pushed the checkExamples branch 2 times, most recently from b4066aa to 4dceaeb Compare December 9, 2018 08:36
@brettz9
Copy link
Collaborator Author

brettz9 commented Dec 9, 2018

I've made one small change in my amendment (in addition to the document additions) to ensure reportUnusedDisableDirectives always applies.

…gajus#101);

    with settings to:
    1. require JSDoc-spec'd `<caption>` at beginning of `@example`
    2. regex settings to whitelist and blacklist lintable examples
    3. setting for a dummy file name to trigger specific rules defined in one's
         config; usable with ESLint `overrides`->`files` globs, to apply a desired
         subset of rules with `@example` (besides allowing for rules specific to
         examples, can be useful for using same rules within `@example` as
         with JavaScript Markdown lintable by other plugins)
    4. Other settings for specifying config (base config object or an `.eslintrc`
         config file; checks normal `.eslintrc` by default unless
         `eslintrcForExamples` setting is set to `false`)
    5. Provides some defaults for suppressing reporting of rules which are
         likely to be troublesome in example files unless
         `noDefaultExampleRules` setting is `true`
- Report column (for checkExamples and any that report it)
@gajus gajus merged commit 41b240f into gajus:master Dec 9, 2018
@gajus
Copy link
Owner

gajus commented Dec 9, 2018

🎉 This PR is included in version 3.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Full ESLint on JavaScript within @example
2 participants