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
34 changes: 34 additions & 0 deletions .changeset/hip-boxes-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
'@cloudfour/eslint-plugin': major
---

Update `eslint-plugin-jsdoc` from `v39` to `v46`

**Reconfigured Rules**

The `@cloudfour/jsdoc/tag-lines` rule is now configured to enforce one blank line in JSDoc comments between the description of a function and the `@param`/other tags.

For example, the blank line after the description is enforced here:

```js
/**
* This is the description for the function, the blank line below this is enforced
*
* @param {string} name A parameter called name
*/
function someFunction(name) {}
```

**New Rules**

- [`@cloudfour/jsdoc/informative-docs`](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/informative-docs.md#repos-sticky-header)
- [`@cloudfour/jsdoc/no-blank-block-descriptions`](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-block-descriptions.md#repos-sticky-header)
- [`@cloudfour/jsdoc/no-blank-blocks`](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-blank-blocks.md#repos-sticky-header)

**Deleted Rules**

- [`@cloudfour/jsdoc/newline-after-description`](https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-newline-after-description)

**Newly Enabled Rules**

- [`@cloudfour/jsdoc/no-defaults`](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-defaults.md#repos-sticky-header)
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const internalSlotsMap = new WeakMap();

/**
* Create the config array from `baseConfig` and `rulePaths`.
*
* @param {CascadingConfigArrayFactoryInternalSlots} slots The slots.
* @returns {ConfigArray} The config array of the base configs.
*/
Expand Down Expand Up @@ -139,6 +140,7 @@ function createBaseConfigArray({

/**
* Create the config array from CLI options.
*
* @param {CascadingConfigArrayFactoryInternalSlots} slots The slots.
* @returns {ConfigArray} The config array of the base configs.
*/
Expand Down Expand Up @@ -192,6 +194,7 @@ class ConfigurationNotFoundError extends Error {
class CascadingConfigArrayFactory {
/**
* Initialize this enumerator.
*
* @param {CascadingConfigArrayFactoryOptions} options The options.
*/
constructor({
Expand Down Expand Up @@ -241,6 +244,7 @@ class CascadingConfigArrayFactory {
/**
* The path to the current working directory.
* This is used by tests.
*
* @type {string}
*/
get cwd() {
Expand All @@ -253,6 +257,7 @@ class CascadingConfigArrayFactory {
* Get the config array of a given file.
* If `filePath` was not given, it returns the config which contains only
* `baseConfigData` and `cliConfigData`.
*
* @param {string} [filePath] The file path to a file.
* @param {object} [options] The options.
* @param {boolean} [options.ignoreNotFoundError] If `true` then it doesn't throw `ConfigurationNotFoundError`.
Expand All @@ -278,6 +283,7 @@ class CascadingConfigArrayFactory {

/**
* Clear config cache.
*
* @returns {void}
*/
clearCache() {
Expand All @@ -290,6 +296,7 @@ class CascadingConfigArrayFactory {

/**
* Load and normalize config files from the ancestor directories.
*
* @param {string} directoryPath The path to a leaf directory.
* @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories.
* @returns {ConfigArray} The loaded config.
Expand Down Expand Up @@ -376,6 +383,7 @@ class CascadingConfigArrayFactory {

/**
* Freeze and cache a given config.
*
* @param {string} directoryPath The path to a directory as a cache key.
* @param {ConfigArray} configArray The config array as a cache value.
* @returns {ConfigArray} The `configArray` (frozen).
Expand All @@ -392,6 +400,7 @@ class CascadingConfigArrayFactory {
/**
* Finalize a given config array.
* Concatenate `--config` and other CLI options.
*
* @param {ConfigArray} configArray The parent config array.
* @param {string} directoryPath The path to the leaf directory to find config files.
* @param {boolean} ignoreNotFoundError If `true` then it doesn't throw `ConfigurationNotFoundError`.
Expand Down
33 changes: 33 additions & 0 deletions fixtures/eslint/lib/cli-engine/config-array-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const internalSlotsMap = new WeakMap();

/**
* Check if a given string is a file path.
*
* @param {string} nameOrPath A module name or file path.
* @returns {boolean} `true` if the `nameOrPath` is a file path.
*/
Expand All @@ -120,6 +121,7 @@ function isFilePath(nameOrPath) {

/**
* Convenience wrapper for synchronously reading file contents.
*
* @param {string} filePath The filename to read.
* @returns {string} The file contents, with the BOM removed.
* @private
Expand All @@ -130,6 +132,7 @@ function readFile(filePath) {

/**
* Loads a YAML configuration from a file.
*
* @param {string} filePath The filename to load.
* @returns {ConfigData} The configuration object from the file.
* @throws {Error} If the file cannot be read.
Expand All @@ -153,6 +156,7 @@ function loadYAMLConfigFile(filePath) {

/**
* Loads a JSON configuration from a file.
*
* @param {string} filePath The filename to load.
* @returns {ConfigData} The configuration object from the file.
* @throws {Error} If the file cannot be read.
Expand All @@ -177,6 +181,7 @@ function loadJSONConfigFile(filePath) {

/**
* Loads a legacy (.eslintrc) configuration from a file.
*
* @param {string} filePath The filename to load.
* @returns {ConfigData} The configuration object from the file.
* @throws {Error} If the file cannot be read.
Expand All @@ -202,6 +207,7 @@ function loadLegacyConfigFile(filePath) {

/**
* Loads a JavaScript configuration from a file.
*
* @param {string} filePath The filename to load.
* @returns {ConfigData} The configuration object from the file.
* @throws {Error} If the file cannot be read.
Expand All @@ -220,6 +226,7 @@ function loadJSConfigFile(filePath) {

/**
* Loads a configuration from a package.json file.
*
* @param {string} filePath The filename to load.
* @returns {ConfigData} The configuration object from the file.
* @throws {Error} If the file cannot be read.
Expand Down Expand Up @@ -247,6 +254,7 @@ function loadPackageJSONConfigFile(filePath) {

/**
* Loads a `.eslintignore` from a file.
*
* @param {string} filePath The filename to load.
* @returns {string[]} The ignore patterns from the file.
* @private
Expand All @@ -267,6 +275,7 @@ function loadESLintIgnoreFile(filePath) {

/**
* Creates an error to notify about a missing config to extend from.
*
* @param {string} configName The name of the missing config.
* @param {string} importerName The name of the config that imported the missing config
* @returns {Error} The error object to throw
Expand All @@ -285,6 +294,7 @@ function configMissingError(configName, importerName) {
/**
* Loads a configuration file regardless of the source. Inspects the file path
* to determine the correctly way to load the config file.
*
* @param {string} filePath The path to the configuration.
* @returns {ConfigData|null} The configuration information.
* @private
Expand Down Expand Up @@ -317,6 +327,7 @@ function loadConfigFile(filePath) {

/**
* Write debug log.
*
* @param {string} request The requested module name.
* @param {string} relativeTo The file path to resolve the request relative to.
* @param {string} filePath The resolved file path.
Expand Down Expand Up @@ -345,6 +356,7 @@ function writeDebugLogForLoading(request, relativeTo, filePath) {

/**
* Create a new context with default values.
*
* @param {string | undefined} cwd The current working directory.
* @param {"config" | "ignore" | "implicit-processor" | undefined} providedType The type of the current configuration. Default is `"config"`.
* @param {string | undefined} providedName The name of the current configuration. Default is the relative path from `cwd` to `filePath`.
Expand Down Expand Up @@ -373,6 +385,7 @@ function createContext(
* Normalize a given plugin.
* - Ensure the object to have four properties: configs, environments, processors, and rules.
* - Ensure the object to not have other properties.
*
* @param {Plugin} plugin The plugin to normalize.
* @returns {Plugin} The normalized plugin.
*/
Expand All @@ -395,6 +408,7 @@ function normalizePlugin(plugin) {
class ConfigArrayFactory {
/**
* Initialize this instance.
*
* @param {ConfigArrayFactoryOptions} [options] The map for additional plugins.
*/
constructor({
Expand All @@ -411,6 +425,7 @@ class ConfigArrayFactory {

/**
* Create `ConfigArray` instance from a config data.
*
* @param {ConfigData|null} configData The config data to create.
* @param {object} [options] The options.
* @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.
Expand All @@ -432,6 +447,7 @@ class ConfigArrayFactory {

/**
* Load a config file.
*
* @param {string} filePath The path to a config file.
* @param {object} [options] The options.
* @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.
Expand All @@ -447,6 +463,7 @@ class ConfigArrayFactory {

/**
* Load the config file on a given directory if exists.
*
* @param {string} directoryPath The path to a directory.
* @param {object} [options] The options.
* @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.
Expand Down Expand Up @@ -489,6 +506,7 @@ class ConfigArrayFactory {

/**
* Check if a config file on a given directory exists or not.
*
* @param {string} directoryPath The path to a directory.
* @returns {string | null} The path to the found config file. If not found then null.
*/
Expand All @@ -515,6 +533,7 @@ class ConfigArrayFactory {

/**
* Load `.eslintignore` file.
*
* @param {string} filePath The path to a `.eslintignore` file to load.
* @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.
*/
Expand All @@ -531,6 +550,7 @@ class ConfigArrayFactory {

/**
* Load `.eslintignore` file in the current working directory.
*
* @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.
*/
loadDefaultESLintIgnore() {
Expand Down Expand Up @@ -571,6 +591,7 @@ class ConfigArrayFactory {

/**
* Load a given config file.
*
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
* @returns {IterableIterator<ConfigArrayElement>} Loaded config.
* @private
Expand All @@ -581,6 +602,7 @@ class ConfigArrayFactory {

/**
* Normalize a given `.eslintignore` data to config array elements.
*
* @param {string[]} ignorePatterns The patterns to ignore files.
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
* @yields {ConfigArrayElement} The normalized config.
Expand All @@ -601,6 +623,7 @@ class ConfigArrayFactory {

/**
* Normalize a given config to an array.
*
* @param {ConfigData} configData The config data to normalize.
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
Expand All @@ -613,6 +636,7 @@ class ConfigArrayFactory {

/**
* Normalize a given config to an array.
*
* @param {ConfigData|OverrideConfigData} configData The config data to normalize.
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
* @yields {ConfigArrayElement} The normalized config.
Expand Down Expand Up @@ -650,6 +674,7 @@ class ConfigArrayFactory {

/**
* Normalize a given config to an array.
*
* @param {ConfigData} configData The config data to normalize.
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
* @yields {ConfigArrayElement} The normalized config.
Expand Down Expand Up @@ -730,6 +755,7 @@ class ConfigArrayFactory {

/**
* Load configs of an element in `extends`.
*
* @param {string} extendName The name of a base config.
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
Expand All @@ -755,6 +781,7 @@ class ConfigArrayFactory {

/**
* Load configs of an element in `extends`.
*
* @param {string} extendName The name of a base config.
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
Expand Down Expand Up @@ -782,6 +809,7 @@ class ConfigArrayFactory {

/**
* Load configs of an element in `extends`.
*
* @param {string} extendName The name of a base config.
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
Expand Down Expand Up @@ -813,6 +841,7 @@ class ConfigArrayFactory {

/**
* Load configs of an element in `extends`.
*
* @param {string} extendName The name of a base config.
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
Expand Down Expand Up @@ -854,6 +883,7 @@ class ConfigArrayFactory {

/**
* Load given plugins.
*
* @param {string[]} names The plugin names to load.
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
* @returns {Record<string,DependentPlugin>} The loaded parser.
Expand All @@ -873,6 +903,7 @@ class ConfigArrayFactory {

/**
* Load a given parser.
*
* @param {string} nameOrPath The package name or the path to a parser file.
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
* @returns {DependentParser} The loaded parser.
Expand Down Expand Up @@ -926,6 +957,7 @@ class ConfigArrayFactory {

/**
* Load a given plugin.
*
* @param {string} name The plugin name to load.
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
* @returns {DependentPlugin} The loaded plugin.
Expand Down Expand Up @@ -1025,6 +1057,7 @@ class ConfigArrayFactory {

/**
* Take file expression processors as config array elements.
*
* @param {Record<string,DependentPlugin>} plugins The plugin definitions.
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
* @yields {ConfigArrayElement} The config array elements of file expression processors.
Expand Down
Loading