From 4c019c7ada60ea8e6c91e7e794526976b8f518dd Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Sat, 4 Nov 2023 17:51:51 -0400 Subject: [PATCH] docs: autogenerate many rule options list with eslint-doc-generator --- docs/rules/dynamic-import-chunkname.md | 9 +++++ docs/rules/max-dependencies.md | 14 ++++---- docs/rules/named.md | 10 ++++++ docs/rules/namespace.md | 8 +++++ docs/rules/newline-after-import.md | 12 ++++--- docs/rules/no-absolute-path.md | 13 +++++-- docs/rules/no-cycle.md | 14 ++++++++ docs/rules/no-duplicates.md | 11 ++++++ docs/rules/no-dynamic-require.md | 10 ++++++ docs/rules/no-import-module-exports.md | 14 +++----- docs/rules/no-internal-modules.md | 10 ++++-- docs/rules/no-namespace.md | 8 +++-- docs/rules/no-nodejs-modules.md | 8 +++-- docs/rules/no-relative-packages.md | 13 +++++++ docs/rules/no-relative-parent-imports.md | 13 +++++++ docs/rules/no-unassigned-import.md | 11 ++++-- docs/rules/no-unresolved.md | 13 +++++++ docs/rules/no-unused-modules.md | 19 ++++++---- docs/rules/no-useless-path-segments.md | 9 +++++ docs/rules/prefer-default-export.md | 44 ++++-------------------- package.json | 2 +- src/rules/max-dependencies.js | 4 +-- src/rules/named.js | 1 + src/rules/newline-after-import.js | 5 +-- src/rules/no-duplicates.js | 2 ++ src/rules/no-dynamic-require.js | 1 + src/rules/no-import-module-exports.js | 2 +- src/rules/no-internal-modules.js | 2 ++ src/rules/no-namespace.js | 1 + src/rules/no-nodejs-modules.js | 1 + src/rules/no-unassigned-import.js | 1 + src/rules/no-unused-modules.js | 5 ++- utils/moduleVisitor.js | 6 ++-- 33 files changed, 209 insertions(+), 87 deletions(-) diff --git a/docs/rules/dynamic-import-chunkname.md b/docs/rules/dynamic-import-chunkname.md index 35ae9df51..83f43580d 100644 --- a/docs/rules/dynamic-import-chunkname.md +++ b/docs/rules/dynamic-import-chunkname.md @@ -11,6 +11,15 @@ This rule enforces naming of webpack chunks in dynamic imports. When you don't e This rule runs against `import()` by default, but can be configured to also run against an alternative dynamic-import function, e.g. 'dynamicImport.' You can also configure the regex format you'd like to accept for the webpackChunkName - for example, if we don't want the number 6 to show up in our chunk names: + + +| Name | Type | +| :----------------------- | :------- | +| `importFunctions` | String[] | +| `webpackChunknameFormat` | String | + + + ```javascript { "dynamic-import-chunkname": [2, { diff --git a/docs/rules/max-dependencies.md b/docs/rules/max-dependencies.md index 1ecbca64d..4371e8036 100644 --- a/docs/rules/max-dependencies.md +++ b/docs/rules/max-dependencies.md @@ -10,14 +10,14 @@ Importing multiple named exports from a single module will only count once (e.g. ## Options -This rule has the following options, with these defaults: + -```js -"import/max-dependencies": ["error", { - "max": 10, - "ignoreTypeImports": false, -}] -``` +| Name | Type | Default | +| :------------------ | :------ | :------ | +| `ignoreTypeImports` | Boolean | `false` | +| `max` | Number | `10` | + + ### `max` diff --git a/docs/rules/named.md b/docs/rules/named.md index 44f8dc658..37616d444 100644 --- a/docs/rules/named.md +++ b/docs/rules/named.md @@ -86,6 +86,16 @@ then the following is not reported: import { notWhatever } from './whatever' ``` +## Options + + + +| Name | Type | Default | +| :--------- | :------ | :------ | +| `commonjs` | Boolean | `false` | + + + ## When Not To Use It If you are using CommonJS and/or modifying the exported namespace of any module at diff --git a/docs/rules/namespace.md b/docs/rules/namespace.md index 1a177f581..45b8d40f7 100644 --- a/docs/rules/namespace.md +++ b/docs/rules/namespace.md @@ -79,6 +79,14 @@ function deepTrouble() { ### Options + + +| Name | Description | Type | Default | +| :-------------- | :---------------------------------------------------------------------------------------- | :------ | :------ | +| `allowComputed` | If `false`, will report computed (and thus, un-lintable) references to namespace members. | Boolean | `false` | + + + #### `allowComputed` Defaults to `false`. When false, will report the following: diff --git a/docs/rules/newline-after-import.md b/docs/rules/newline-after-import.md index ef5aeed76..a2f6c4584 100644 --- a/docs/rules/newline-after-import.md +++ b/docs/rules/newline-after-import.md @@ -8,13 +8,15 @@ Enforces having one or more empty lines after the last top-level import statemen ## Rule Details -This rule supports the following options: + - - `count` which sets the number of newlines that are enforced after the last top-level import statement or require call. This option defaults to `1`. +| Name | Description | Type | Default | +| :----------------- | :------------------------------------------------------------------------------------------------------- | :------ | :------ | +| `considerComments` | enforces the rule on comments after the last import-statement as well when set to true | Boolean | `false` | +| `count` | Sets the number of newlines that are enforced after the last top-level import statement or require call. | Integer | | +| `exactCount` | enforce the exact numbers of newlines that is mentioned in `count` | Boolean | `false` | - - `exactCount` which enforce the exact numbers of newlines that is mentioned in `count`. This option defaults to `false`. - - - `considerComments` which enforces the rule on comments after the last import-statement as well when set to true. This option defaults to `false`. + Valid: diff --git a/docs/rules/no-absolute-path.md b/docs/rules/no-absolute-path.md index 48fb9532b..47c1bf7e1 100644 --- a/docs/rules/no-absolute-path.md +++ b/docs/rules/no-absolute-path.md @@ -38,9 +38,16 @@ By default, only ES6 imports and CommonJS `require` calls will have this rule en You may provide an options object providing true/false for any of - - `esmodule`: defaults to `true` - - `commonjs`: defaults to `true` - - `amd`: defaults to `false` + + +| Name | Type | Default | +| :--------- | :------- | :------ | +| `amd` | Boolean | `false` | +| `commonjs` | Boolean | `true` | +| `esmodule` | Boolean | `true` | +| `ignore` | String[] | | + + If `{ amd: true }` is provided, dependency paths for AMD-style `define` and `require` calls will be resolved: diff --git a/docs/rules/no-cycle.md b/docs/rules/no-cycle.md index 76e96f95f..6fcbf7678 100644 --- a/docs/rules/no-cycle.md +++ b/docs/rules/no-cycle.md @@ -28,6 +28,20 @@ This rule ignores type-only imports in Flow and TypeScript syntax (`import type` ### Options + + +| Name | Description | Type | Default | +| :----------------------------------- | :--------------------------------------------------------------------------- | :------- | :------ | +| `allowUnsafeDynamicCyclicDependency` | Allow cyclic dependency if there is at least one dynamic import in the chain | Boolean | `false` | +| `amd` | | Boolean | `false` | +| `commonjs` | | Boolean | `true` | +| `esmodule` | | Boolean | `true` | +| `ignore` | | String[] | | +| `ignoreExternal` | ignore external modules | Boolean | `false` | +| `maxDepth` | | | | + + + By default, this rule only detects cycles for ES6 imports, but see the [`no-unresolved` options](./no-unresolved.md#options) as this rule also supports the same `commonjs` and `amd` flags. However, these flags only impact which import types are _linted_; the import/export infrastructure only registers `import` statements in dependencies, so cycles created by `require` within imported modules may not be detected. diff --git a/docs/rules/no-duplicates.md b/docs/rules/no-duplicates.md index 29c16f15d..3ef56011a 100644 --- a/docs/rules/no-duplicates.md +++ b/docs/rules/no-duplicates.md @@ -42,6 +42,17 @@ The motivation is that this is likely a result of two developers importing diffe names from the same module at different times (and potentially largely different locations in the file.) This rule brings both (or n-many) to attention. +## Options + + + +| Name | Type | Default | +| :-------------------- | :------ | :------ | +| `considerQueryString` | Boolean | `false` | +| `prefer-inline` | Boolean | `false` | + + + ### Query Strings By default, this rule ignores query strings (i.e. paths followed by a question mark), and thus imports from `./mod?a` and `./mod?b` will be considered as duplicates. However you can use the option `considerQueryString` to handle them as different (primarily because browsers will resolve those imports differently). diff --git a/docs/rules/no-dynamic-require.md b/docs/rules/no-dynamic-require.md index 292055fcd..4a2251827 100644 --- a/docs/rules/no-dynamic-require.md +++ b/docs/rules/no-dynamic-require.md @@ -23,3 +23,13 @@ require(name()); require('../name'); require(`../name`); ``` + +## Options + + + +| Name | Type | Default | +| :--------- | :------ | :------ | +| `esmodule` | Boolean | `false` | + + diff --git a/docs/rules/no-import-module-exports.md b/docs/rules/no-import-module-exports.md index 1c5722649..c47bbfb45 100644 --- a/docs/rules/no-import-module-exports.md +++ b/docs/rules/no-import-module-exports.md @@ -12,17 +12,13 @@ If you have multiple entry points or are using `js:next` this rule includes an ## Options -### `exceptions` + - - An array of globs. The rule will be omitted from any file that matches a glob - in the options array. For example, the following setting will omit the rule - in the `some-file.js` file. +| Name | Description | Type | +| :----------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :---- | +| `exceptions` | An array of globs. The rule will be omitted from any file that matches a glob in the options array. For example, `"**/*/some-file.js"` will omit the rule in the `some-file.js` file. | Array | -```json -"import/no-import-module-exports": ["error", { - "exceptions": ["**/*/some-file.js"] -}] -``` + ## Rule Details diff --git a/docs/rules/no-internal-modules.md b/docs/rules/no-internal-modules.md index 433b55140..b3c43e931 100644 --- a/docs/rules/no-internal-modules.md +++ b/docs/rules/no-internal-modules.md @@ -8,8 +8,14 @@ Use this rule to prevent importing the submodules of other modules. This rule has two mutally exclusive options that are arrays of [minimatch/glob patterns](https://github.com/isaacs/node-glob#glob-primer) patterns: - - `allow` that include paths and import statements that can be imported with reaching. - - `forbid` that exclude paths and import statements that can be imported with reaching. + + +| Name | Description | Type | +| :------- | :---------------------------------------------------------------------- | :------- | +| `allow` | Include paths and import statements that can be imported with reaching. | String[] | +| `forbid` | Exclude paths and import statements that can be imported with reaching. | String[] | + + ### Examples diff --git a/docs/rules/no-namespace.md b/docs/rules/no-namespace.md index c7346515a..5c53f134d 100644 --- a/docs/rules/no-namespace.md +++ b/docs/rules/no-namespace.md @@ -10,9 +10,13 @@ The rule is auto-fixable when the namespace object is only used for direct membe ## Options -This rule supports the following options: + - - `ignore`: array of glob strings for modules that should be ignored by the rule. +| Name | Description | Type | +| :------- | :----------------------------------------------------------- | :------- | +| `ignore` | Glob strings for modules that should be ignored by the rule. | String[] | + + ## Rule Details diff --git a/docs/rules/no-nodejs-modules.md b/docs/rules/no-nodejs-modules.md index 5cbc90728..d7df9b76d 100644 --- a/docs/rules/no-nodejs-modules.md +++ b/docs/rules/no-nodejs-modules.md @@ -6,9 +6,13 @@ Forbid the use of Node.js builtin modules. Can be useful for client-side web pro ## Options -This rule supports the following options: + - - `allow`: Array of names of allowed modules. Defaults to an empty array. +| Name | Description | Type | +| :------ | :------------------------ | :------- | +| `allow` | Names of allowed modules. | String[] | + + ## Rule Details diff --git a/docs/rules/no-relative-packages.md b/docs/rules/no-relative-packages.md index 4014ed985..a54737e51 100644 --- a/docs/rules/no-relative-packages.md +++ b/docs/rules/no-relative-packages.md @@ -68,3 +68,16 @@ import bar from 'bar'; // Import sibling package using package name import bar from 'bar'; // Import sibling package using package name ``` + +## Options + + + +| Name | Type | Default | +| :--------- | :------- | :------ | +| `amd` | Boolean | `false` | +| `commonjs` | Boolean | `true` | +| `esmodule` | Boolean | `true` | +| `ignore` | String[] | | + + diff --git a/docs/rules/no-relative-parent-imports.md b/docs/rules/no-relative-parent-imports.md index c1f978487..29af50019 100644 --- a/docs/rules/no-relative-parent-imports.md +++ b/docs/rules/no-relative-parent-imports.md @@ -121,3 +121,16 @@ import a from './lib/a'; // Import child file using relative path import b from './b'; // Import sibling file using relative path ``` + +## Options + + + +| Name | Type | Default | +| :--------- | :------- | :------ | +| `amd` | Boolean | `false` | +| `commonjs` | Boolean | `true` | +| `esmodule` | Boolean | `true` | +| `ignore` | String[] | | + + diff --git a/docs/rules/no-unassigned-import.md b/docs/rules/no-unassigned-import.md index 617395e2c..eb5f71adb 100644 --- a/docs/rules/no-unassigned-import.md +++ b/docs/rules/no-unassigned-import.md @@ -11,11 +11,16 @@ This rule aims to remove modules with side-effects by reporting when a module is ## Options -This rule supports the following option: + -`allow`: An Array of globs. The files that match any of these patterns would be ignored/allowed by the linter. This can be useful for some build environments (e.g. css-loader in webpack). +| Name | Description | Type | +| :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------ | +| `allow` | An Array of globs. The files that match any of these patterns would be ignored/allowed by the linter. This can be useful for some build environments (e.g. css-loader in webpack). Note that the globs start from the where the linter is executed (usually project root), but not from each file that includes the source. Learn more in both the pass and fail examples below. | String[] | +| `devDependencies` | | Boolean,array | +| `optionalDependencies` | | Boolean,array | +| `peerDependencies` | | Boolean,array | -Note that the globs start from the where the linter is executed (usually project root), but not from each file that includes the source. Learn more in both the pass and fail examples below. + ## Fail diff --git a/docs/rules/no-unresolved.md b/docs/rules/no-unresolved.md index ca1da39c0..5c3059f25 100644 --- a/docs/rules/no-unresolved.md +++ b/docs/rules/no-unresolved.md @@ -21,6 +21,19 @@ If you are using Webpack, see the section on [resolvers](../../README.md#resolve ### Options + + +| Name | Type | Default | +| :-------------------- | :------- | :------ | +| `amd` | Boolean | `false` | +| `caseSensitive` | Boolean | `true` | +| `caseSensitiveStrict` | Boolean | `false` | +| `commonjs` | Boolean | `true` | +| `esmodule` | Boolean | `true` | +| `ignore` | String[] | | + + + By default, only ES6 imports will be resolved: ```js diff --git a/docs/rules/no-unused-modules.md b/docs/rules/no-unused-modules.md index 53c247927..af568143c 100644 --- a/docs/rules/no-unused-modules.md +++ b/docs/rules/no-unused-modules.md @@ -25,12 +25,19 @@ Example: ### Options -This rule takes the following option: - - - **`missingExports`**: if `true`, files without any exports are reported (defaults to `false`) - - **`unusedExports`**: if `true`, exports without any static usage within other modules are reported (defaults to `false`) - - `src`: an array with files/paths to be analyzed. It only applies to unused exports. Defaults to `process.cwd()`, if not provided - - `ignoreExports`: an array with files/paths for which unused exports will not be reported (e.g module entry points in a published package) + + +| Name | Description | Type | Choices | Default | Required | +| :--------------- | :--------------------------------------------------------------------------------------------------------- | :------- | :------ | :-------------- | :------- | +| `ignoreExports` | files/paths for which unused exports will not be reported (e.g module entry points in a published package) | String[] | | | | +| `missingExports` | report modules without any exports | Boolean | | `false` | | +| `missingExports` | | | `true` | | Yes | +| `src` | files/paths to be analyzed (only for unused exports) | String[] | | `process.cwd()` | | +| `src` | | | | | | +| `unusedExports` | report exports without any usage | Boolean | | `false` | | +| `unusedExports` | | | `true` | | Yes | + + ### Example for missing exports diff --git a/docs/rules/no-useless-path-segments.md b/docs/rules/no-useless-path-segments.md index 22c4bf965..07c66cc2e 100644 --- a/docs/rules/no-useless-path-segments.md +++ b/docs/rules/no-useless-path-segments.md @@ -59,6 +59,15 @@ import fs from "fs"; ## Options + + +| Name | Type | +| :--------------- | :------ | +| `commonjs` | Boolean | +| `noUselessIndex` | Boolean | + + + ### noUselessIndex If you want to detect unnecessary `/index` or `/index.js` (depending on the specified file extensions, see below) imports in your paths, you can enable the option `noUselessIndex`. By default it is set to `false`: diff --git a/docs/rules/prefer-default-export.md b/docs/rules/prefer-default-export.md index e2a7bacd7..4e6420606 100644 --- a/docs/rules/prefer-default-export.md +++ b/docs/rules/prefer-default-export.md @@ -6,40 +6,20 @@ In exporting files, this rule checks if there is default export or not. ## Rule Details -### rule schema +### Config Options -```javascript -"import/prefer-default-export": [ - ( "off" | "warn" | "error" ), - { "target": "single" | "any" } // default is "single" -] -``` + -### Config Options +| Name | Type | Choices | Default | +| :------- | :----- | :-------------- | :------- | +| `target` | String | `single`, `any` | `single` | -There are two options available: `single` and `any`. By default, if you do not specify the option, rule will assume it is `single`. + #### single **Definition**: When there is only a single export from a module, prefer using default export over named export. -How to setup config file for this rule: - -```javascript -// you can manually specify it -"rules": { - "import/prefer-default-export": [ - ( "off" | "warn" | "error" ), - { "target": "single" } - ] -} - -// config setup below will also work -"rules": { - "import/prefer-default-export": "off" | "warn" | "error" -} -``` - The following patterns are considered warnings: ```javascript @@ -97,18 +77,6 @@ export * from './other-module' **Definition**: any exporting file must contain a default export. -How to setup config file for this rule: - -```javascript -// you have to manually specify it -"rules": { - "import/prefer-default-export": [ - ( "off" | "warn" | "error" ), - { "target": "any" } - ] -} -``` - The following patterns are *not* considered warnings: ```javascript diff --git a/package.json b/package.json index bd92f4f69..3ab52f55b 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "cross-env": "^4.0.0", "escope": "^3.6.0", "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8", - "eslint-doc-generator": "^1.4.3", + "eslint-doc-generator": "^1.5.3", "eslint-import-resolver-node": "file:./resolvers/node", "eslint-import-resolver-typescript": "^1.0.2 || ^1.1.1", "eslint-import-resolver-webpack": "file:./resolvers/webpack", diff --git a/src/rules/max-dependencies.js b/src/rules/max-dependencies.js index 488e90618..a73199027 100644 --- a/src/rules/max-dependencies.js +++ b/src/rules/max-dependencies.js @@ -26,8 +26,8 @@ module.exports = { { type: 'object', properties: { - max: { type: 'number' }, - ignoreTypeImports: { type: 'boolean' }, + max: { type: 'number', default: 10 }, + ignoreTypeImports: { type: 'boolean', default: false }, }, additionalProperties: false, }, diff --git a/src/rules/named.js b/src/rules/named.js index e7fe4e4dc..3d6a2d533 100644 --- a/src/rules/named.js +++ b/src/rules/named.js @@ -16,6 +16,7 @@ module.exports = { properties: { commonjs: { type: 'boolean', + default: false, }, }, additionalProperties: false, diff --git a/src/rules/newline-after-import.js b/src/rules/newline-after-import.js index a33bb615b..522eeb56e 100644 --- a/src/rules/newline-after-import.js +++ b/src/rules/newline-after-import.js @@ -68,9 +68,10 @@ module.exports = { count: { type: 'integer', minimum: 1, + description: 'Sets the number of newlines that are enforced after the last top-level import statement or require call.', }, - exactCount: { type: 'boolean' }, - considerComments: { type: 'boolean' }, + exactCount: { type: 'boolean', description: 'enforce the exact numbers of newlines that is mentioned in `count`', default: false }, + considerComments: { type: 'boolean', description: 'enforces the rule on comments after the last import-statement as well when set to true', default: false }, }, additionalProperties: false, }, diff --git a/src/rules/no-duplicates.js b/src/rules/no-duplicates.js index 6b4f4d559..3abece8ed 100644 --- a/src/rules/no-duplicates.js +++ b/src/rules/no-duplicates.js @@ -282,9 +282,11 @@ module.exports = { properties: { considerQueryString: { type: 'boolean', + default: false, }, 'prefer-inline': { type: 'boolean', + default: false, }, }, additionalProperties: false, diff --git a/src/rules/no-dynamic-require.js b/src/rules/no-dynamic-require.js index f8b369a70..3f9573e03 100644 --- a/src/rules/no-dynamic-require.js +++ b/src/rules/no-dynamic-require.js @@ -35,6 +35,7 @@ module.exports = { properties: { esmodule: { type: 'boolean', + default: false, }, }, additionalProperties: false, diff --git a/src/rules/no-import-module-exports.js b/src/rules/no-import-module-exports.js index bc4605c39..493732be5 100644 --- a/src/rules/no-import-module-exports.js +++ b/src/rules/no-import-module-exports.js @@ -37,7 +37,7 @@ module.exports = { { type: 'object', properties: { - exceptions: { type: 'array' }, + exceptions: { type: 'array', description: 'An array of globs. The rule will be omitted from any file that matches a glob in the options array. For example, `"**/*/some-file.js"` will omit the rule in the `some-file.js` file.' }, }, additionalProperties: false, }, diff --git a/src/rules/no-internal-modules.js b/src/rules/no-internal-modules.js index 5ed456547..33381ff13 100644 --- a/src/rules/no-internal-modules.js +++ b/src/rules/no-internal-modules.js @@ -25,6 +25,7 @@ module.exports = { items: { type: 'string', }, + description: 'Include paths and import statements that can be imported with reaching.', }, }, additionalProperties: false, @@ -37,6 +38,7 @@ module.exports = { items: { type: 'string', }, + description: 'Exclude paths and import statements that can be imported with reaching.', }, }, additionalProperties: false, diff --git a/src/rules/no-namespace.js b/src/rules/no-namespace.js index d3e591876..b7e2a3d63 100644 --- a/src/rules/no-namespace.js +++ b/src/rules/no-namespace.js @@ -28,6 +28,7 @@ module.exports = { type: 'string', }, uniqueItems: true, + description: 'Glob strings for modules that should be ignored by the rule.', }, }, }], diff --git a/src/rules/no-nodejs-modules.js b/src/rules/no-nodejs-modules.js index 82594bb60..5350e662d 100644 --- a/src/rules/no-nodejs-modules.js +++ b/src/rules/no-nodejs-modules.js @@ -26,6 +26,7 @@ module.exports = { items: { type: 'string', }, + description: 'Names of allowed modules.', }, }, additionalProperties: false, diff --git a/src/rules/no-unassigned-import.js b/src/rules/no-unassigned-import.js index 0af9f2e9f..0392efdaa 100644 --- a/src/rules/no-unassigned-import.js +++ b/src/rules/no-unassigned-import.js @@ -73,6 +73,7 @@ module.exports = { items: { type: 'string', }, + description: 'An Array of globs. The files that match any of these patterns would be ignored/allowed by the linter. This can be useful for some build environments (e.g. css-loader in webpack). Note that the globs start from the where the linter is executed (usually project root), but not from each file that includes the source. Learn more in both the pass and fail examples below.', }, }, additionalProperties: false, diff --git a/src/rules/no-unused-modules.js b/src/rules/no-unused-modules.js index ecba3a19c..38fa8cb7c 100644 --- a/src/rules/no-unused-modules.js +++ b/src/rules/no-unused-modules.js @@ -419,9 +419,10 @@ module.exports = { type: 'string', minLength: 1, }, + default: 'process.cwd()', }, ignoreExports: { - description: 'files/paths for which unused exports will not be reported (e.g module entry points)', + description: 'files/paths for which unused exports will not be reported (e.g module entry points in a published package)', type: 'array', uniqueItems: true, items: { @@ -432,10 +433,12 @@ module.exports = { missingExports: { description: 'report modules without any exports', type: 'boolean', + default: false, }, unusedExports: { description: 'report exports without any usage', type: 'boolean', + default: false, }, }, anyOf: [ diff --git a/utils/moduleVisitor.js b/utils/moduleVisitor.js index c312ca2d4..bcb653ede 100644 --- a/utils/moduleVisitor.js +++ b/utils/moduleVisitor.js @@ -122,9 +122,9 @@ function makeOptionsSchema(additionalProperties) { const base = { type: 'object', properties: { - commonjs: { type: 'boolean' }, - amd: { type: 'boolean' }, - esmodule: { type: 'boolean' }, + commonjs: { type: 'boolean', default: true }, + amd: { type: 'boolean', default: false }, + esmodule: { type: 'boolean', default: true }, ignore: { type: 'array', minItems: 1,