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
67 changes: 2 additions & 65 deletions .README/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,69 +27,7 @@ npm install --save-dev eslint-plugin-jsdoc

## Configuration

### Flat config (procedural)

This is the currently recommended approach.

```js
import jsdoc from 'eslint-plugin-jsdoc';

export default [
...jsdoc({
config: 'flat/recommended',
})
];
```

Or with settings supplied:

```js
import jsdoc from 'eslint-plugin-jsdoc';

export default [
...jsdoc({
config: 'flat/recommended',
// Uncomment this if you wish your `settings` to overwrite the config's own settings;
// otherwise, the default behavior is to merge recursively
// mergeSettings: false,
settings: {
// Do not add a `jsdoc` child object here as you would for regular ESLint `settings`
structuredTags: {
see: {
name: 'namepath-referencing',
required: [
'name',
],
},
},
/*
// Since the recommended config has been chosen, the above settings will
// be merged by default with the following (which are tags that are
// being allowed and requiring a type):
structuredTags: {
next: {
required: [
'type',
],
},
throws: {
required: [
'type',
],
},
yields: {
required: [
'type',
],
},
},
*/
}
})
];
```

### Flat config (declarative)
### Flat config

```js
import jsdoc from 'eslint-plugin-jsdoc';
Expand All @@ -100,7 +38,6 @@ const config = [
// other configuration objects...
{
files: ['**/*.js'],
// `plugins` here is not necessary if including the above config
plugins: {
jsdoc,
},
Expand Down Expand Up @@ -137,7 +74,7 @@ These each only enable mostly or only rules from the recommended starting rules:
- `jsdoc.configs['flat/logical-typescript-error']`: for TypeScript files, with reports set to error
- `jsdoc.configs['flat/logical-typescript-flavor']`: for files using JavaScript syntax and JSDoc types, with reports set to warn
- `jsdoc.configs['flat/logical-typescript-flavor-error']`: for files using JavaScript syntax and JSDoc types, with reports set to error
- **Requirements**: rules that enforce tags exist or have or don't have types
- **Requirements**: rules that enforce tags exist
- `jsdoc.configs['flat/requirements-typescript']`: for TypeScript files, with reports set to warn
- `jsdoc.configs['flat/requirements-typescript-error']`: for TypeScript files, with reports set to error
- `jsdoc.configs['flat/requirements-typescript-flavor']`: for files using JavaScript syntax and JSDoc types, with reports set to warn
Expand Down
84 changes: 9 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ JSDoc linting rules for ESLint.
* [eslint-plugin-jsdoc](#user-content-eslint-plugin-jsdoc)
* [Installation](#user-content-eslint-plugin-jsdoc-installation)
* [Configuration](#user-content-eslint-plugin-jsdoc-configuration)
* [Flat config (procedural)](#user-content-eslint-plugin-jsdoc-configuration-flat-config-procedural)
* [Flat config (declarative)](#user-content-eslint-plugin-jsdoc-configuration-flat-config-declarative)
* [Flat config](#user-content-eslint-plugin-jsdoc-configuration-flat-config)
* [`eslintrc`](#user-content-eslint-plugin-jsdoc-configuration-eslintrc)
* [Options](#user-content-eslint-plugin-jsdoc-options)
* [Settings](#user-content-eslint-plugin-jsdoc-settings)
Expand Down Expand Up @@ -44,73 +43,9 @@ npm install --save-dev eslint-plugin-jsdoc
<a name="eslint-plugin-jsdoc-configuration"></a>
## Configuration

<a name="user-content-eslint-plugin-jsdoc-configuration-flat-config-procedural"></a>
<a name="eslint-plugin-jsdoc-configuration-flat-config-procedural"></a>
### Flat config (procedural)

This is the currently recommended approach.

```js
import jsdoc from 'eslint-plugin-jsdoc';

export default [
...jsdoc({
config: 'flat/recommended',
})
];
```

Or with settings supplied:

```js
import jsdoc from 'eslint-plugin-jsdoc';

export default [
...jsdoc({
config: 'flat/recommended',
// Uncomment this if you wish your `settings` to overwrite the config's own settings;
// otherwise, the default behavior is to merge recursively
// mergeSettings: false,
settings: {
// Do not add a `jsdoc` child object here as you would for regular ESLint `settings`
structuredTags: {
see: {
name: 'namepath-referencing',
required: [
'name',
],
},
},
/*
// Since the recommended config has been chosen, the above settings will
// be merged by default with the following (which are tags that are
// being allowed and requiring a type):
structuredTags: {
next: {
required: [
'type',
],
},
throws: {
required: [
'type',
],
},
yields: {
required: [
'type',
],
},
},
*/
}
})
];
```

<a name="user-content-eslint-plugin-jsdoc-configuration-flat-config-declarative"></a>
<a name="eslint-plugin-jsdoc-configuration-flat-config-declarative"></a>
### Flat config (declarative)
<a name="user-content-eslint-plugin-jsdoc-configuration-flat-config"></a>
<a name="eslint-plugin-jsdoc-configuration-flat-config"></a>
### Flat config

```js
import jsdoc from 'eslint-plugin-jsdoc';
Expand All @@ -121,7 +56,6 @@ const config = [
// other configuration objects...
{
files: ['**/*.js'],
// `plugins` here is not necessary if including the above config
plugins: {
jsdoc,
},
Expand All @@ -143,8 +77,8 @@ The general starting rulesets you can extend from in flat config are:
- `jsdoc.configs['flat/recommended-typescript-flavor']`: A similar recommended starting list, adjusted for projects using JavaScript syntax (source files that are still `.js`) but using TypeScript flavor within JSDoc (i.e., the default "typescript" `mode` in `eslint-plugin-jsdoc`)
- `jsdoc.configs['flat/recommended-typescript-flavor-error']`: The same, reporting with failing errors instead of mere warnings

<a name="user-content-eslint-plugin-jsdoc-configuration-flat-config-declarative-granular-flat-configs"></a>
<a name="eslint-plugin-jsdoc-configuration-flat-config-declarative-granular-flat-configs"></a>
<a name="user-content-eslint-plugin-jsdoc-configuration-flat-config-granular-flat-configs"></a>
<a name="eslint-plugin-jsdoc-configuration-flat-config-granular-flat-configs"></a>
#### Granular Flat Configs

There also exist several more granular, standalone TypeScript rulesets you can extend from.
Expand All @@ -160,7 +94,7 @@ These each only enable mostly or only rules from the recommended starting rules:
- `jsdoc.configs['flat/logical-typescript-error']`: for TypeScript files, with reports set to error
- `jsdoc.configs['flat/logical-typescript-flavor']`: for files using JavaScript syntax and JSDoc types, with reports set to warn
- `jsdoc.configs['flat/logical-typescript-flavor-error']`: for files using JavaScript syntax and JSDoc types, with reports set to error
- **Requirements**: rules that enforce tags exist or have or don't have types
- **Requirements**: rules that enforce tags exist
- `jsdoc.configs['flat/requirements-typescript']`: for TypeScript files, with reports set to warn
- `jsdoc.configs['flat/requirements-typescript-error']`: for TypeScript files, with reports set to error
- `jsdoc.configs['flat/requirements-typescript-flavor']`: for files using JavaScript syntax and JSDoc types, with reports set to warn
Expand All @@ -183,8 +117,8 @@ export default [
];
```

<a name="user-content-eslint-plugin-jsdoc-configuration-flat-config-declarative-granular-flat-configs-why-certain-rules-were-excluded-from-the-granular-configs"></a>
<a name="eslint-plugin-jsdoc-configuration-flat-config-declarative-granular-flat-configs-why-certain-rules-were-excluded-from-the-granular-configs"></a>
<a name="user-content-eslint-plugin-jsdoc-configuration-flat-config-granular-flat-configs-why-certain-rules-were-excluded-from-the-granular-configs"></a>
<a name="eslint-plugin-jsdoc-configuration-flat-config-granular-flat-configs-why-certain-rules-were-excluded-from-the-granular-configs"></a>
##### Why certain rules were excluded from the granular configs

A few rules were left out of the granular configs. Here is why:
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"escape-string-regexp": "^4.0.0",
"espree": "^10.4.0",
"esquery": "^1.6.0",
"object-deep-merge": "^1.0.5",
"parse-imports-exports": "^0.2.4",
"semver": "^7.7.2",
"spdx-expression-parse": "^4.0.0"
Expand All @@ -22,6 +21,7 @@
"@babel/cli": "^7.28.3",
"@babel/core": "^7.28.4",
"@babel/eslint-parser": "^7.28.4",
"@babel/node": "^7.28.0",
"@babel/plugin-syntax-class-properties": "^7.12.13",
"@babel/plugin-transform-flow-strip-types": "^7.27.1",
"@babel/preset-env": "^7.28.3",
Expand All @@ -37,6 +37,7 @@
"@types/esquery": "^1.5.4",
"@types/estree": "^1.0.8",
"@types/json-schema": "^7.0.15",
"@types/lodash.defaultsdeep": "^4.6.9",
"@types/mocha": "^10.0.10",
"@types/node": "^24.3.1",
"@types/semver": "^7.7.1",
Expand All @@ -58,6 +59,7 @@
"jsdoc-type-pratt-parser": "^5.1.1",
"json-schema": "^0.4.0",
"lint-staged": "^16.1.6",
"lodash.defaultsdeep": "^4.6.1",
"mocha": "^11.7.2",
"open-editor": "^5.1.0",
"replace": "^1.2.2",
Expand Down Expand Up @@ -138,9 +140,9 @@
"tsc": "tsc",
"tsc-build": "tsc -p tsconfig-prod.json",
"build": "rimraf ./dist && NODE_ENV=production babel ./src --out-file-extension .cjs --out-dir ./dist --copy-files --source-maps --ignore ./src/bin/*.js --no-copy-ignored && replace 'require\\(\"\\.(.*?)\\.[^.]*?\"\\)' 'require(\".$1.cjs\")' 'dist' -r --include=\"*.cjs\" && pnpm tsc-build",
"check-docs": "node ./src/bin/generateDocs.js --check",
"create-docs": "pnpm run create-options && node ./src/bin/generateDocs.js",
"create-rule": "node ./src/bin/generateRule.js",
"check-docs": "babel-node ./src/bin/generateDocs.js --check",
"create-docs": "pnpm run create-options && babel-node ./src/bin/generateDocs.js",
"create-rule": "babel-node ./src/bin/generateRule.js",
"create-options": "node ./src/bin/generateOptions.js",
"install-offline": "pnpm install --prefer-offline --no-audit",
"lint": "eslint",
Expand Down
Loading
Loading