Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .README/processors.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ For defaults, a couple rules are enabled which are usually useful:

```js
import {getJsdocProcessorPlugin} from 'eslint-plugin-jsdoc';
import {
import ts, {
parser as typescriptEslintParser,
} from 'typescript-eslint';

Expand Down Expand Up @@ -129,8 +129,10 @@ export default [
},
processor: 'examples/examples'
},
// Apply your TypeScript config
...ts.configs.recommended,
{
// Target the blocks within TypeScript
// Target the @example blocks within TypeScript
files: [
// `**/*.ts` could also work if you want to share this config
// with other non-@example TypeScript
Expand All @@ -144,8 +146,13 @@ export default [
rules: {
// Add the rules you want to apply to @example here
'no-extra-semi': 'error',

// disable problematic rules here, e.g.,
// ...jsdoc.configs.examples[1].rules

// Due to https://github.com/gajus/eslint-plugin-jsdoc/issues/1377 ,
// `typescript-eslint` type-checked rules must currently be disbaled
...ts.configs.disableTypeChecked.rules
}
}
];
Expand Down
2 changes: 1 addition & 1 deletion .README/rules/check-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ by decreasing precedence:
use extra lines within examples just for easier illustration
purposes.
* `no-undef` - Many variables in examples will be `undefined`.
* `no-unused-vars` - It is common to define variables for clarity without
* `no-unused-vars` (and `@typescript-eslint/no-unused-vars`) - It is common to define variables for clarity without
always using them within examples.
* `padded-blocks` (and `@stylistic/padded-blocks`) - It can generally look
nicer to pad a little even if one's code follows more stringency as far
Expand Down
11 changes: 9 additions & 2 deletions docs/processors.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ For defaults, a couple rules are enabled which are usually useful:

```js
import {getJsdocProcessorPlugin} from 'eslint-plugin-jsdoc';
import {
import ts, {
parser as typescriptEslintParser,
} from 'typescript-eslint';

Expand Down Expand Up @@ -133,8 +133,10 @@ export default [
},
processor: 'examples/examples'
},
// Apply your TypeScript config
...ts.configs.recommended,
{
// Target the blocks within TypeScript
// Target the @example blocks within TypeScript
files: [
// `**/*.ts` could also work if you want to share this config
// with other non-@example TypeScript
Expand All @@ -148,8 +150,13 @@ export default [
rules: {
// Add the rules you want to apply to @example here
'no-extra-semi': 'error',

// disable problematic rules here, e.g.,
// ...jsdoc.configs.examples[1].rules

// Due to https://github.com/gajus/eslint-plugin-jsdoc/issues/1377 ,
// `typescript-eslint` type-checked rules must currently be disbaled
...ts.configs.disableTypeChecked.rules
}
}
];
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/check-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ by decreasing precedence:
use extra lines within examples just for easier illustration
purposes.
* `no-undef` - Many variables in examples will be `undefined`.
* `no-unused-vars` - It is common to define variables for clarity without
* `no-unused-vars` (and `@typescript-eslint/no-unused-vars`) - It is common to define variables for clarity without
always using them within examples.
* `padded-blocks` (and `@stylistic/padded-blocks`) - It can generally look
nicer to pad a little even if one's code follows more stringency as far
Expand Down
2 changes: 2 additions & 0 deletions src/index-cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ index.configs.examples = /** @type {import('eslint').Linter.Config[]} */ ([
// Can generally look nicer to pad a little even if code imposes more stringency
'@stylistic/padded-blocks': 0,

'@typescript-eslint/no-unused-vars': 0,

// "always" newline rule at end unlikely in sample code
'eol-last': 0,

Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,8 @@ index.configs.examples = /** @type {import('eslint').Linter.Config[]} */ ([
// Can generally look nicer to pad a little even if code imposes more stringency
'@stylistic/padded-blocks': 0,

'@typescript-eslint/no-unused-vars': 0,

// "always" newline rule at end unlikely in sample code
'eol-last': 0,

Expand Down
2 changes: 2 additions & 0 deletions src/rules/checkExamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ const defaultMdRules = {
// Can generally look nicer to pad a little even if code imposes more stringency
'@stylistic/padded-blocks': 0,

'@typescript-eslint/no-unused-vars': 0,

// "always" newline rule at end unlikely in sample code
'eol-last': 0,

Expand Down
Loading