npm-package-json-lint 11.2.0 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api.d.ts +68 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,7 +85,7 @@ First thing first, let's make sure you have the necessary pre-requisites.
|
|
|
85
85
|
##### From the command line
|
|
86
86
|
|
|
87
87
|
* Once npm-package-json-lint is installed either in the project or globally it can be run with the
|
|
88
|
-
following command, `npx npm-package-json-lint
|
|
88
|
+
following command, `npx npm-package-json-lint .`. This will go through the process of linting/validating
|
|
89
89
|
your code to meet your desired specifications. For an example configuration file, please see [configuration examples section on the website](https://npmpackagejsonlint.org/docs/configuration/#config-examples).
|
|
90
90
|
|
|
91
91
|
##### In the program
|
package/dist/api.d.ts
CHANGED
|
@@ -235,6 +235,73 @@ export declare class NpmPackageJsonLint {
|
|
|
235
235
|
lint(): OverallLintingResult;
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
238
|
+
Severity of a rule in a configuration file.
|
|
239
|
+
*/
|
|
240
|
+
type RuleSeverity = 'error' | 'warning' | 'off';
|
|
241
|
+
/**
|
|
242
|
+
Configuration of a single rule.
|
|
243
|
+
|
|
244
|
+
- Standard rules take a severity, e.g. `'error'`.
|
|
245
|
+
- Array rules take a severity and a list of values, e.g. `['error', ['MIT', 'ISC']]`.
|
|
246
|
+
- Object rules take a severity and an options object, e.g. `['error', {requireEndingPeriod: true}]`.
|
|
247
|
+
- Optional object rules take either form, e.g. `'error'` or `['error', {exceptions: ['my-module']}]`.
|
|
248
|
+
*/
|
|
249
|
+
type RuleConfig = RuleSeverity | [RuleSeverity, unknown[]] | [RuleSeverity, Record<string, unknown>];
|
|
250
|
+
/**
|
|
251
|
+
Rules to apply, keyed by rule name.
|
|
252
|
+
*/
|
|
253
|
+
type RulesConfig = Record<string, RuleConfig>;
|
|
254
|
+
/**
|
|
255
|
+
Rules that apply only to package.json files matching `patterns`.
|
|
256
|
+
*/
|
|
257
|
+
interface ConfigurationOverride {
|
|
258
|
+
/**
|
|
259
|
+
Glob patterns, relative to the current working directory, of the package.json files the rules apply to.
|
|
260
|
+
*/
|
|
261
|
+
patterns: string[];
|
|
262
|
+
/**
|
|
263
|
+
Rules to apply to the matching files.
|
|
264
|
+
*/
|
|
265
|
+
rules: RulesConfig;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
npm-package-json-lint configuration, as written in `.npmpackagejsonlintrc.json`,
|
|
269
|
+
`npmpackagejsonlint.config.js`, or the `npmpackagejsonlint` property of package.json.
|
|
270
|
+
|
|
271
|
+
In a JavaScript config file, add `// @ts-check`, put the JSDoc tag
|
|
272
|
+
`@type {import('npm-package-json-lint').Configuration}` on a `const`, and export that `const`.
|
|
273
|
+
TypeScript doesn't check the tag when it's placed directly on `module.exports`.
|
|
274
|
+
|
|
275
|
+
@example
|
|
276
|
+
```ts
|
|
277
|
+
import type {Configuration} from 'npm-package-json-lint';
|
|
278
|
+
|
|
279
|
+
const config: Configuration = {
|
|
280
|
+
rules: {
|
|
281
|
+
'require-author': 'error',
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
```
|
|
285
|
+
*/
|
|
286
|
+
interface Configuration {
|
|
287
|
+
/**
|
|
288
|
+
Shareable configs to extend, e.g. `'npm-package-json-lint:default'`, a module name, or a file path.
|
|
289
|
+
*/
|
|
290
|
+
extends?: string | string[];
|
|
291
|
+
/**
|
|
292
|
+
Allowed by the configuration schema. It doesn't change how configuration files are found.
|
|
293
|
+
*/
|
|
294
|
+
root?: boolean;
|
|
295
|
+
/**
|
|
296
|
+
Rules to apply, keyed by rule name.
|
|
297
|
+
*/
|
|
298
|
+
rules?: RulesConfig;
|
|
299
|
+
/**
|
|
300
|
+
Rules that apply only to some package.json files, e.g. in a monorepo.
|
|
301
|
+
*/
|
|
302
|
+
overrides?: ConfigurationOverride[];
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
238
305
|
Print results to console
|
|
239
306
|
|
|
240
307
|
@param linterOutput An array of LintIssues
|
|
@@ -242,4 +309,4 @@ Print results to console
|
|
|
242
309
|
@internal
|
|
243
310
|
*/
|
|
244
311
|
export declare const write: (linterOutput: any, isQuiet: boolean) => void;
|
|
245
|
-
export type { LinterResult, NpmPackageJsonLintOptions, OverallAggregatedResultCounts, PackageJsonFileAggregatedResultCounts, PackageJsonFileLintingResult, Rule };
|
|
312
|
+
export type { Configuration, ConfigurationOverride, LinterResult, NpmPackageJsonLintOptions, OverallAggregatedResultCounts, PackageJsonFileAggregatedResultCounts, PackageJsonFileLintingResult, Rule, RuleConfig, RuleSeverity, RulesConfig };
|