@alexlit/lint-kit 174.0.0 → 175.0.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/package.json +1 -1
- package/packages/config-eslint/node_modules/@eslint/config-array/LICENSE +201 -0
- package/packages/config-eslint/node_modules/@eslint/config-array/README.md +368 -0
- package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/index.cjs +1536 -0
- package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/index.d.cts +144 -0
- package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/std__path/posix.cjs +1336 -0
- package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/std__path/windows.cjs +1678 -0
- package/packages/config-eslint/node_modules/@eslint/config-array/dist/cjs/types.cts +29 -0
- package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/index.d.ts +144 -0
- package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/index.js +1511 -0
- package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/std__path/posix.js +1314 -0
- package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/std__path/windows.js +1656 -0
- package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/types.d.ts +23 -0
- package/packages/config-eslint/node_modules/@eslint/config-array/dist/esm/types.ts +29 -0
- package/packages/config-eslint/node_modules/@eslint/config-array/package.json +65 -0
- package/packages/config-eslint/node_modules/@eslint/config-helpers/LICENSE +201 -0
- package/packages/config-eslint/node_modules/@eslint/config-helpers/README.md +97 -0
- package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/cjs/index.cjs +588 -0
- package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/cjs/index.d.cts +26 -0
- package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/cjs/types.cts +29 -0
- package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/esm/index.d.ts +26 -0
- package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/esm/index.js +586 -0
- package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/esm/types.d.ts +23 -0
- package/packages/config-eslint/node_modules/@eslint/config-helpers/dist/esm/types.ts +29 -0
- package/packages/config-eslint/node_modules/@eslint/config-helpers/package.json +60 -0
- package/packages/config-eslint/node_modules/@eslint/js/LICENSE +19 -0
- package/packages/config-eslint/node_modules/@eslint/js/README.md +103 -0
- package/packages/config-eslint/node_modules/@eslint/js/package.json +44 -0
- package/packages/config-eslint/node_modules/@eslint/js/src/configs/eslint-all.js +210 -0
- package/packages/config-eslint/node_modules/@eslint/js/src/configs/eslint-recommended.js +75 -0
- package/packages/config-eslint/node_modules/@eslint/js/src/index.js +23 -0
- package/packages/config-eslint/node_modules/@eslint/js/types/index.d.ts +14 -0
- package/packages/config-eslint/node_modules/@eslint/object-schema/LICENSE +201 -0
- package/packages/config-eslint/node_modules/@eslint/object-schema/README.md +243 -0
- package/packages/config-eslint/node_modules/@eslint/object-schema/dist/cjs/index.cjs +459 -0
- package/packages/config-eslint/node_modules/@eslint/object-schema/dist/cjs/index.d.cts +127 -0
- package/packages/config-eslint/node_modules/@eslint/object-schema/dist/cjs/types.cts +57 -0
- package/packages/config-eslint/node_modules/@eslint/object-schema/dist/esm/index.d.ts +127 -0
- package/packages/config-eslint/node_modules/@eslint/object-schema/dist/esm/index.js +456 -0
- package/packages/config-eslint/node_modules/@eslint/object-schema/dist/esm/types.d.ts +40 -0
- package/packages/config-eslint/node_modules/@eslint/object-schema/dist/esm/types.ts +57 -0
- package/packages/config-eslint/node_modules/@eslint/object-schema/package.json +62 -0
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/LICENSE +201 -0
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/README.md +273 -0
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs +895 -0
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts +329 -0
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/cjs/types.cts +81 -0
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts +329 -0
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/index.js +890 -0
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts +46 -0
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/dist/esm/types.ts +81 -0
- package/packages/config-eslint/node_modules/@eslint/plugin-kit/package.json +62 -0
- package/packages/config-eslint/node_modules/ajv/.tonic_example.js +20 -0
- package/packages/config-eslint/node_modules/ajv/LICENSE +22 -0
- package/packages/config-eslint/node_modules/ajv/README.md +1497 -0
- package/packages/config-eslint/node_modules/ajv/dist/ajv.bundle.js +7189 -0
- package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js +3 -0
- package/packages/config-eslint/node_modules/ajv/dist/ajv.min.js.map +1 -0
- package/packages/config-eslint/node_modules/ajv/lib/ajv.d.ts +397 -0
- package/packages/config-eslint/node_modules/ajv/lib/ajv.js +506 -0
- package/packages/config-eslint/node_modules/ajv/lib/cache.js +26 -0
- package/packages/config-eslint/node_modules/ajv/lib/compile/async.js +90 -0
- package/packages/config-eslint/node_modules/ajv/lib/compile/equal.js +5 -0
- package/packages/config-eslint/node_modules/ajv/lib/compile/error_classes.js +34 -0
- package/packages/config-eslint/node_modules/ajv/lib/compile/formats.js +142 -0
- package/packages/config-eslint/node_modules/ajv/lib/compile/index.js +387 -0
- package/packages/config-eslint/node_modules/ajv/lib/compile/resolve.js +270 -0
- package/packages/config-eslint/node_modules/ajv/lib/compile/rules.js +66 -0
- package/packages/config-eslint/node_modules/ajv/lib/compile/schema_obj.js +9 -0
- package/packages/config-eslint/node_modules/ajv/lib/compile/ucs2length.js +20 -0
- package/packages/config-eslint/node_modules/ajv/lib/compile/util.js +239 -0
- package/packages/config-eslint/node_modules/ajv/lib/data.js +49 -0
- package/packages/config-eslint/node_modules/ajv/lib/definition_schema.js +37 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/_limit.jst +113 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/_limitItems.jst +12 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/_limitLength.jst +12 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/_limitProperties.jst +12 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/allOf.jst +32 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/anyOf.jst +46 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/coerce.def +51 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/comment.jst +9 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/const.jst +11 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/contains.jst +55 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/custom.jst +191 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/defaults.def +47 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/definitions.def +203 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/dependencies.jst +79 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/enum.jst +30 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/errors.def +194 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/format.jst +106 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/if.jst +73 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/items.jst +98 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/missing.def +39 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/multipleOf.jst +22 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/not.jst +43 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/oneOf.jst +54 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/pattern.jst +14 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/properties.jst +245 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/propertyNames.jst +52 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/ref.jst +85 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/required.jst +108 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/uniqueItems.jst +62 -0
- package/packages/config-eslint/node_modules/ajv/lib/dot/validate.jst +276 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/README.md +3 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limit.js +163 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitItems.js +80 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitLength.js +85 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/_limitProperties.js +80 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/allOf.js +42 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/anyOf.js +73 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/comment.js +14 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/const.js +56 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/contains.js +81 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/custom.js +228 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/dependencies.js +168 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/enum.js +66 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/format.js +150 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/if.js +103 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/index.js +33 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/items.js +140 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/multipleOf.js +80 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/not.js +84 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/oneOf.js +73 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/pattern.js +75 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/properties.js +335 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/propertyNames.js +81 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/ref.js +124 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/required.js +270 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/uniqueItems.js +86 -0
- package/packages/config-eslint/node_modules/ajv/lib/dotjs/validate.js +482 -0
- package/packages/config-eslint/node_modules/ajv/lib/keyword.js +146 -0
- package/packages/config-eslint/node_modules/ajv/lib/refs/data.json +17 -0
- package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-04.json +149 -0
- package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-06.json +154 -0
- package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-draft-07.json +168 -0
- package/packages/config-eslint/node_modules/ajv/lib/refs/json-schema-secure.json +94 -0
- package/packages/config-eslint/node_modules/ajv/package.json +106 -0
- package/packages/config-eslint/node_modules/ajv/scripts/.eslintrc.yml +3 -0
- package/packages/config-eslint/node_modules/ajv/scripts/bundle.js +61 -0
- package/packages/config-eslint/node_modules/ajv/scripts/compile-dots.js +73 -0
- package/packages/config-eslint/node_modules/ajv/scripts/info +10 -0
- package/packages/config-eslint/node_modules/ajv/scripts/prepare-tests +12 -0
- package/packages/config-eslint/node_modules/ajv/scripts/publish-built-version +32 -0
- package/packages/config-eslint/node_modules/ajv/scripts/travis-gh-pages +23 -0
- package/packages/config-eslint/node_modules/eslint/LICENSE +19 -0
- package/packages/config-eslint/node_modules/eslint/README.md +363 -0
- package/packages/config-eslint/node_modules/eslint/bin/eslint.js +195 -0
- package/packages/config-eslint/node_modules/eslint/conf/ecma-version.js +16 -0
- package/packages/config-eslint/node_modules/eslint/conf/globals.js +169 -0
- package/packages/config-eslint/node_modules/eslint/conf/replacements.json +26 -0
- package/packages/config-eslint/node_modules/eslint/conf/rule-type-list.json +91 -0
- package/packages/config-eslint/node_modules/eslint/lib/api.js +39 -0
- package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/formatters-meta.json +18 -0
- package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/html.js +359 -0
- package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js +16 -0
- package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/json.js +13 -0
- package/packages/config-eslint/node_modules/eslint/lib/cli-engine/formatters/stylish.js +153 -0
- package/packages/config-eslint/node_modules/eslint/lib/cli-engine/hash.js +35 -0
- package/packages/config-eslint/node_modules/eslint/lib/cli-engine/lint-result-cache.js +220 -0
- package/packages/config-eslint/node_modules/eslint/lib/cli.js +521 -0
- package/packages/config-eslint/node_modules/eslint/lib/config/config-loader.js +668 -0
- package/packages/config-eslint/node_modules/eslint/lib/config/config.js +674 -0
- package/packages/config-eslint/node_modules/eslint/lib/config/default-config.js +78 -0
- package/packages/config-eslint/node_modules/eslint/lib/config/flat-config-array.js +217 -0
- package/packages/config-eslint/node_modules/eslint/lib/config/flat-config-schema.js +598 -0
- package/packages/config-eslint/node_modules/eslint/lib/config-api.js +12 -0
- package/packages/config-eslint/node_modules/eslint/lib/eslint/eslint-helpers.js +1462 -0
- package/packages/config-eslint/node_modules/eslint/lib/eslint/eslint.js +1364 -0
- package/packages/config-eslint/node_modules/eslint/lib/eslint/index.js +7 -0
- package/packages/config-eslint/node_modules/eslint/lib/eslint/worker.js +173 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/index.js +336 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/index.js +7 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/source-code.js +1178 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-comment-cursor.js +61 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-cursor.js +57 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/cursor.js +76 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/cursors.js +120 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/decorative-cursor.js +38 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/filter-cursor.js +42 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/forward-token-comment-cursor.js +65 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/forward-token-cursor.js +62 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/index.js +695 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/limit-cursor.js +39 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/padded-token-cursor.js +45 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/skip-cursor.js +41 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/source-code/token-store/utils.js +131 -0
- package/packages/config-eslint/node_modules/eslint/lib/languages/js/validate-language-options.js +196 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/apply-disable-directives.js +583 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js +828 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js +262 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js +2370 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/code-path.js +332 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js +223 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js +374 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js +44 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/esquery.js +332 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/file-context.js +88 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/file-report.js +604 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/index.js +11 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/interpolate.js +50 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/linter.js +1614 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/rule-fixer.js +199 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/source-code-fixer.js +154 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/source-code-traverser.js +333 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/source-code-visitor.js +81 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/timing.js +209 -0
- package/packages/config-eslint/node_modules/eslint/lib/linter/vfile.js +115 -0
- package/packages/config-eslint/node_modules/eslint/lib/options.js +416 -0
- package/packages/config-eslint/node_modules/eslint/lib/rule-tester/index.js +7 -0
- package/packages/config-eslint/node_modules/eslint/lib/rule-tester/rule-tester.js +1996 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/accessor-pairs.js +420 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/array-bracket-newline.js +291 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/array-bracket-spacing.js +301 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/array-callback-return.js +510 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/array-element-newline.js +374 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/arrow-body-style.js +418 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/arrow-parens.js +237 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/arrow-spacing.js +188 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/block-scoped-var.js +137 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/block-spacing.js +202 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/brace-style.js +278 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/callback-return.js +216 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/camelcase.js +422 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/capitalized-comments.js +325 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/class-methods-use-this.js +250 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/comma-dangle.js +424 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/comma-spacing.js +205 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/comma-style.js +391 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/complexity.js +201 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/computed-property-spacing.js +251 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/consistent-return.js +221 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/consistent-this.js +179 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/constructor-super.js +453 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/curly.js +425 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/default-case-last.js +51 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/default-case.js +103 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/default-param-last.js +78 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/dot-location.js +138 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/dot-notation.js +216 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/eol-last.js +135 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/eqeqeq.js +210 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/for-direction.js +168 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/func-call-spacing.js +281 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/func-name-matching.js +338 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/func-names.js +194 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/func-style.js +221 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/function-call-argument-newline.js +166 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/function-paren-newline.js +368 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/generator-star-spacing.js +246 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/getter-return.js +242 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/global-require.js +117 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/grouped-accessor-pairs.js +268 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/guard-for-in.js +85 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/handle-callback-err.js +122 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/id-blacklist.js +241 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/id-denylist.js +223 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/id-length.js +217 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/id-match.js +363 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js +125 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/indent-legacy.js +1369 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/indent.js +2334 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/index.js +332 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/init-declarations.js +172 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/jsx-quotes.js +128 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/key-spacing.js +822 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/keyword-spacing.js +701 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/line-comment-position.js +157 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/linebreak-style.js +135 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/lines-around-comment.js +581 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/lines-around-directive.js +249 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/lines-between-class-members.js +358 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/logical-assignment-operators.js +688 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/max-classes-per-file.js +90 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/max-depth.js +159 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/max-len.js +497 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/max-lines-per-function.js +238 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/max-lines.js +189 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/max-nested-callbacks.js +115 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/max-params.js +148 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/max-statements-per-line.js +224 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/max-statements.js +188 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/multiline-comment-style.js +652 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/multiline-ternary.js +257 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/new-cap.js +277 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/new-parens.js +120 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/newline-after-var.js +307 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/newline-before-return.js +242 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/newline-per-chained-call.js +159 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-alert.js +149 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-array-constructor.js +195 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-async-promise-executor.js +45 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-await-in-loop.js +115 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-bitwise.js +145 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-buffer-constructor.js +74 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-caller.js +52 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-case-declarations.js +80 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-catch-shadow.js +96 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-class-assign.js +66 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-compare-neg-zero.js +74 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-cond-assign.js +175 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-confusing-arrow.js +127 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-console.js +221 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-const-assign.js +73 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-constant-binary-expression.js +603 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-constant-condition.js +177 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-constructor-return.js +62 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-continue.js +38 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-control-regex.js +142 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-debugger.js +41 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-delete-var.js +42 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-div-regex.js +60 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-args.js +92 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-class-members.js +117 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-else-if.js +145 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-dupe-keys.js +165 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-duplicate-case.js +78 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-duplicate-imports.js +368 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-else-return.js +450 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-character-class.js +83 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-function.js +236 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-pattern.js +85 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty-static-block.js +73 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-empty.js +153 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-eq-null.js +51 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-eval.js +295 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-ex-assign.js +57 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-extend-native.js +180 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-bind.js +224 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-boolean-cast.js +420 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-label.js +169 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-parens.js +1669 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-extra-semi.js +167 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-fallthrough.js +260 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-floating-decimal.js +99 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-func-assign.js +77 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-global-assign.js +101 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-implicit-coercion.js +468 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-implicit-globals.js +187 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-implied-eval.js +171 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-import-assign.js +227 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-inline-comments.js +115 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-inner-declarations.js +147 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-invalid-regexp.js +244 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-invalid-this.js +178 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-irregular-whitespace.js +292 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-iterator.js +48 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-label-var.js +78 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-labels.js +156 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-lone-blocks.js +140 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-lonely-if.js +126 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-loop-func.js +267 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-loss-of-precision.js +249 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-magic-numbers.js +365 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-misleading-character-class.js +595 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-mixed-operators.js +253 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-mixed-requires.js +267 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js +148 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-multi-assign.js +66 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-multi-spaces.js +179 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-multi-str.js +67 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-multiple-empty-lines.js +210 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-native-reassign.js +114 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-negated-condition.js +100 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-negated-in-lhs.js +59 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-nested-ternary.js +46 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-func.js +96 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-native-nonconstructor.js +70 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-object.js +76 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-require.js +67 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-symbol.js +74 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-new-wrappers.js +62 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-new.js +42 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js +176 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-obj-calls.js +99 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-object-constructor.js +124 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-octal-escape.js +53 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-octal.js +42 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-param-reassign.js +248 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-path-concat.js +79 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-plusplus.js +102 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-process-env.js +68 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-process-exit.js +67 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-promise-executor-return.js +264 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-proto.js +45 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-prototype-builtins.js +181 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-redeclare.js +173 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-regex-spaces.js +219 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-exports.js +227 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-globals.js +266 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-imports.js +892 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-modules.js +249 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-properties.js +233 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-restricted-syntax.js +74 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-return-assign.js +87 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-return-await.js +162 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-script-url.js +68 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-self-assign.js +186 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-self-compare.js +77 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-sequences.js +158 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-setter-return.js +224 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-shadow-restricted-names.js +113 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-shadow.js +689 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-spaced-func.js +105 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-sparse-arrays.js +68 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-sync.js +81 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-tabs.js +110 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-template-curly-in-string.js +45 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-ternary.js +38 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-this-before-super.js +365 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-throw-literal.js +46 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-trailing-spaces.js +227 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-unassigned-vars.js +80 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-undef-init.js +101 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-undef.js +84 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-undefined.js +85 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-underscore-dangle.js +383 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-unexpected-multiline.js +130 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js +360 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-unneeded-ternary.js +232 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-unreachable-loop.js +190 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-unreachable.js +300 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-unsafe-finally.js +119 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-unsafe-negation.js +152 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js +221 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-expressions.js +227 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-labels.js +158 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-private-class-members.js +219 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-unused-vars.js +1739 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-use-before-define.js +446 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-assignment.js +657 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-backreference.js +263 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-call.js +95 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-catch.js +57 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-computed-key.js +204 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-concat.js +121 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-constructor.js +262 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-escape.js +406 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-rename.js +202 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-useless-return.js +401 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-var.js +367 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-void.js +69 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-warning-comments.js +209 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-whitespace-before-property.js +150 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/no-with.js +37 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/nonblock-statement-body-position.js +164 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/object-curly-newline.js +383 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/object-curly-spacing.js +369 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/object-property-newline.js +151 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/object-shorthand.js +652 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/one-var-declaration-per-line.js +117 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/one-var.js +717 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/operator-assignment.js +270 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/operator-linebreak.js +315 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/padded-blocks.js +366 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/padding-line-between-statements.js +612 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-arrow-callback.js +437 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-const.js +546 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-destructuring.js +332 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js +235 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-named-capture-group.js +197 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-numeric-literals.js +157 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-object-has-own.js +148 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-object-spread.js +319 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js +154 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-reflect.js +150 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-regex-literals.js +605 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-rest-params.js +117 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-spread.js +91 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/prefer-template.js +347 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/preserve-caught-error.js +535 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/quote-props.js +394 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/quotes.js +416 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/radix.js +193 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/require-atomic-updates.js +365 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/require-await.js +184 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/require-unicode-regexp.js +317 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/require-yield.js +86 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/rest-spread-spacing.js +150 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/semi-spacing.js +297 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/semi-style.js +218 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/semi.js +476 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/sort-imports.js +319 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/sort-keys.js +268 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/sort-vars.js +140 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/space-before-blocks.js +232 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/space-before-function-paren.js +202 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/space-in-parens.js +374 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/space-infix-ops.js +249 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/space-unary-ops.js +400 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/spaced-comment.js +447 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/strict.js +324 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/switch-colon-spacing.js +158 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/symbol-description.js +70 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/template-curly-spacing.js +168 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/template-tag-spacing.js +121 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/unicode-bom.js +73 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/use-isnan.js +268 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/utils/ast-utils.js +2841 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/utils/char-source.js +247 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/utils/fix-tracker.js +125 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/utils/keywords.js +67 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js +118 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/utils/regular-expressions.js +58 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/index.js +16 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js +13 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js +13 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js +13 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js +14 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/valid-typeof.js +171 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/vars-on-top.js +165 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/wrap-iife.js +238 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/wrap-regex.js +91 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/yield-star-spacing.js +158 -0
- package/packages/config-eslint/node_modules/eslint/lib/rules/yoda.js +362 -0
- package/packages/config-eslint/node_modules/eslint/lib/services/parser-service.js +64 -0
- package/packages/config-eslint/node_modules/eslint/lib/services/processor-service.js +100 -0
- package/packages/config-eslint/node_modules/eslint/lib/services/suppressions-service.js +302 -0
- package/packages/config-eslint/node_modules/eslint/lib/services/warning-service.js +87 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/ajv.js +34 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/assert.js +21 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/ast-utils.js +30 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/deep-merge-arrays.js +62 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/directives.js +16 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/flags.js +89 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/logging.js +38 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/naming.js +109 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/option-utils.js +63 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/relative-module-resolver.js +28 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/runtime-info.js +177 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/serialization.js +78 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/severity.js +49 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/stats.js +30 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/string-utils.js +58 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/text-table.js +68 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/translate-cli-options.js +223 -0
- package/packages/config-eslint/node_modules/eslint/lib/shared/traverser.js +202 -0
- package/packages/config-eslint/node_modules/eslint/lib/types/config-api.d.ts +12 -0
- package/packages/config-eslint/node_modules/eslint/lib/types/index.d.ts +1475 -0
- package/packages/config-eslint/node_modules/eslint/lib/types/rules.d.ts +5603 -0
- package/packages/config-eslint/node_modules/eslint/lib/types/universal.d.ts +6 -0
- package/packages/config-eslint/node_modules/eslint/lib/types/use-at-your-own-risk.d.ts +34 -0
- package/packages/config-eslint/node_modules/eslint/lib/universal.js +10 -0
- package/packages/config-eslint/node_modules/eslint/lib/unsupported-api.js +21 -0
- package/packages/config-eslint/node_modules/eslint/messages/all-files-ignored.js +16 -0
- package/packages/config-eslint/node_modules/eslint/messages/all-matched-files-ignored.js +21 -0
- package/packages/config-eslint/node_modules/eslint/messages/config-file-missing.js +16 -0
- package/packages/config-eslint/node_modules/eslint/messages/config-plugin-missing.js +14 -0
- package/packages/config-eslint/node_modules/eslint/messages/config-serialize-function.js +30 -0
- package/packages/config-eslint/node_modules/eslint/messages/eslintrc-incompat.js +117 -0
- package/packages/config-eslint/node_modules/eslint/messages/eslintrc-plugins.js +27 -0
- package/packages/config-eslint/node_modules/eslint/messages/extend-config-missing.js +13 -0
- package/packages/config-eslint/node_modules/eslint/messages/failed-to-read-json.js +11 -0
- package/packages/config-eslint/node_modules/eslint/messages/file-not-found.js +10 -0
- package/packages/config-eslint/node_modules/eslint/messages/invalid-rule-options.js +17 -0
- package/packages/config-eslint/node_modules/eslint/messages/invalid-rule-severity.js +13 -0
- package/packages/config-eslint/node_modules/eslint/messages/no-config-found.js +15 -0
- package/packages/config-eslint/node_modules/eslint/messages/plugin-conflict.js +22 -0
- package/packages/config-eslint/node_modules/eslint/messages/plugin-invalid.js +16 -0
- package/packages/config-eslint/node_modules/eslint/messages/plugin-missing.js +19 -0
- package/packages/config-eslint/node_modules/eslint/messages/print-config-with-directory-path.js +8 -0
- package/packages/config-eslint/node_modules/eslint/messages/shared.js +23 -0
- package/packages/config-eslint/node_modules/eslint/messages/whitespace-found.js +11 -0
- package/packages/config-eslint/node_modules/eslint/package.json +220 -0
- package/packages/config-eslint/node_modules/eslint-scope/LICENSE +22 -0
- package/packages/config-eslint/node_modules/eslint-scope/README.md +206 -0
- package/packages/config-eslint/node_modules/eslint-scope/dist/eslint-scope.cjs +2420 -0
- package/packages/config-eslint/node_modules/eslint-scope/lib/assert.js +17 -0
- package/packages/config-eslint/node_modules/eslint-scope/lib/definition.js +89 -0
- package/packages/config-eslint/node_modules/eslint-scope/lib/index.d.cts +1069 -0
- package/packages/config-eslint/node_modules/eslint-scope/lib/index.d.ts +6 -0
- package/packages/config-eslint/node_modules/eslint-scope/lib/index.js +170 -0
- package/packages/config-eslint/node_modules/eslint-scope/lib/pattern-visitor.js +157 -0
- package/packages/config-eslint/node_modules/eslint-scope/lib/reference.js +165 -0
- package/packages/config-eslint/node_modules/eslint-scope/lib/referencer.js +712 -0
- package/packages/config-eslint/node_modules/eslint-scope/lib/scope-manager.js +271 -0
- package/packages/config-eslint/node_modules/eslint-scope/lib/scope.js +839 -0
- package/packages/config-eslint/node_modules/eslint-scope/lib/variable.js +91 -0
- package/packages/config-eslint/node_modules/eslint-scope/package.json +69 -0
- package/packages/config-eslint/node_modules/eslint-visitor-keys/LICENSE +201 -0
- package/packages/config-eslint/node_modules/eslint-visitor-keys/README.md +121 -0
- package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs +396 -0
- package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts +28 -0
- package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/index.d.ts +16 -0
- package/packages/config-eslint/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts +12 -0
- package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/index.js +67 -0
- package/packages/config-eslint/node_modules/eslint-visitor-keys/lib/visitor-keys.js +327 -0
- package/packages/config-eslint/node_modules/eslint-visitor-keys/package.json +59 -0
- package/packages/config-eslint/node_modules/espree/LICENSE +25 -0
- package/packages/config-eslint/node_modules/espree/README.md +262 -0
- package/packages/config-eslint/node_modules/espree/dist/espree.cjs +1272 -0
- package/packages/config-eslint/node_modules/espree/dist/espree.d.cts +3 -0
- package/packages/config-eslint/node_modules/espree/dist/espree.d.cts.map +1 -0
- package/packages/config-eslint/node_modules/espree/dist/espree.d.ts +71 -0
- package/packages/config-eslint/node_modules/espree/dist/espree.d.ts.map +1 -0
- package/packages/config-eslint/node_modules/espree/espree.js +291 -0
- package/packages/config-eslint/node_modules/espree/lib/espree.js +482 -0
- package/packages/config-eslint/node_modules/espree/lib/features.js +21 -0
- package/packages/config-eslint/node_modules/espree/lib/options.js +164 -0
- package/packages/config-eslint/node_modules/espree/lib/token-translator.js +306 -0
- package/packages/config-eslint/node_modules/espree/lib/types.js +118 -0
- package/packages/config-eslint/node_modules/espree/package.json +72 -0
- package/packages/config-eslint/node_modules/ignore/LICENSE-MIT +21 -0
- package/packages/config-eslint/node_modules/ignore/README.md +412 -0
- package/packages/config-eslint/node_modules/ignore/index.d.ts +61 -0
- package/packages/config-eslint/node_modules/ignore/index.js +636 -0
- package/packages/config-eslint/node_modules/ignore/legacy.js +559 -0
- package/packages/config-eslint/node_modules/ignore/package.json +74 -0
- package/packages/config-eslint/node_modules/json-schema-traverse/.eslintrc.yml +27 -0
- package/packages/config-eslint/node_modules/json-schema-traverse/.travis.yml +8 -0
- package/packages/config-eslint/node_modules/json-schema-traverse/LICENSE +21 -0
- package/packages/config-eslint/node_modules/json-schema-traverse/README.md +83 -0
- package/packages/config-eslint/node_modules/json-schema-traverse/index.js +89 -0
- package/packages/config-eslint/node_modules/json-schema-traverse/package.json +43 -0
- package/packages/config-eslint/node_modules/json-schema-traverse/spec/.eslintrc.yml +6 -0
- package/packages/config-eslint/node_modules/json-schema-traverse/spec/fixtures/schema.js +125 -0
- package/packages/config-eslint/node_modules/json-schema-traverse/spec/index.spec.js +171 -0
- package/packages/config-eslint/node_modules/minimatch/LICENSE.md +55 -0
- package/packages/config-eslint/node_modules/minimatch/README.md +453 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/ast.d.ts +20 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/ast.js +591 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/brace-expressions.js +152 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/escape.d.ts +15 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/escape.js +30 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/index.d.ts +94 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/index.js +1029 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/package.json +3 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/unescape.d.ts +22 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
- package/packages/config-eslint/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/ast.d.ts +20 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/ast.js +587 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/ast.js.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/brace-expressions.js +148 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/escape.d.ts +15 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/escape.js +26 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/escape.js.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/index.d.ts +94 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/index.js +1016 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/index.js.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/package.json +3 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/unescape.d.ts +22 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/unescape.js +34 -0
- package/packages/config-eslint/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
- package/packages/config-eslint/node_modules/minimatch/package.json +67 -0
- package/packages/config-eslint/package.json +3 -3
|
@@ -0,0 +1,1536 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var posixPath = require('./std__path/posix.cjs');
|
|
4
|
+
var windowsPath = require('./std__path/windows.cjs');
|
|
5
|
+
var minimatch = require('minimatch');
|
|
6
|
+
var createDebug = require('debug');
|
|
7
|
+
var objectSchema = require('@eslint/object-schema');
|
|
8
|
+
|
|
9
|
+
function _interopNamespaceDefault(e) {
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var posixPath__namespace = /*#__PURE__*/_interopNamespaceDefault(posixPath);
|
|
27
|
+
var windowsPath__namespace = /*#__PURE__*/_interopNamespaceDefault(windowsPath);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @fileoverview ConfigSchema
|
|
31
|
+
* @author Nicholas C. Zakas
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
//------------------------------------------------------------------------------
|
|
35
|
+
// Types
|
|
36
|
+
//------------------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
/** @import * as $eslintobjectschema from "@eslint/object-schema"; */
|
|
39
|
+
/** @typedef {$eslintobjectschema.PropertyDefinition} PropertyDefinition */
|
|
40
|
+
/** @typedef {$eslintobjectschema.ObjectDefinition} ObjectDefinition */
|
|
41
|
+
|
|
42
|
+
//------------------------------------------------------------------------------
|
|
43
|
+
// Helpers
|
|
44
|
+
//------------------------------------------------------------------------------
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A strategy that does nothing.
|
|
48
|
+
* @type {PropertyDefinition}
|
|
49
|
+
*/
|
|
50
|
+
const NOOP_STRATEGY = {
|
|
51
|
+
required: false,
|
|
52
|
+
merge() {
|
|
53
|
+
return undefined;
|
|
54
|
+
},
|
|
55
|
+
validate() {},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
//------------------------------------------------------------------------------
|
|
59
|
+
// Exports
|
|
60
|
+
//------------------------------------------------------------------------------
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The base schema that every ConfigArray uses.
|
|
64
|
+
* @type {ObjectDefinition}
|
|
65
|
+
*/
|
|
66
|
+
const baseSchema = Object.freeze({
|
|
67
|
+
name: {
|
|
68
|
+
required: false,
|
|
69
|
+
merge() {
|
|
70
|
+
return undefined;
|
|
71
|
+
},
|
|
72
|
+
validate(value) {
|
|
73
|
+
if (typeof value !== "string") {
|
|
74
|
+
throw new TypeError("Property must be a string.");
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
basePath: NOOP_STRATEGY,
|
|
79
|
+
files: NOOP_STRATEGY,
|
|
80
|
+
ignores: NOOP_STRATEGY,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @fileoverview ConfigSchema
|
|
85
|
+
* @author Nicholas C. Zakas
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
//------------------------------------------------------------------------------
|
|
89
|
+
// Types
|
|
90
|
+
//------------------------------------------------------------------------------
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
//------------------------------------------------------------------------------
|
|
94
|
+
// Helpers
|
|
95
|
+
//------------------------------------------------------------------------------
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Asserts that a given value is an array.
|
|
99
|
+
* @param {*} value The value to check.
|
|
100
|
+
* @returns {void}
|
|
101
|
+
* @throws {TypeError} When the value is not an array.
|
|
102
|
+
*/
|
|
103
|
+
function assertIsArray(value) {
|
|
104
|
+
if (!Array.isArray(value)) {
|
|
105
|
+
throw new TypeError("Expected value to be an array.");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Asserts that a given value is an array containing only strings and functions.
|
|
111
|
+
* @param {*} value The value to check.
|
|
112
|
+
* @returns {void}
|
|
113
|
+
* @throws {TypeError} When the value is not an array of strings and functions.
|
|
114
|
+
*/
|
|
115
|
+
function assertIsArrayOfStringsAndFunctions(value) {
|
|
116
|
+
assertIsArray(value);
|
|
117
|
+
|
|
118
|
+
if (
|
|
119
|
+
value.some(
|
|
120
|
+
item => typeof item !== "string" && typeof item !== "function",
|
|
121
|
+
)
|
|
122
|
+
) {
|
|
123
|
+
throw new TypeError(
|
|
124
|
+
"Expected array to only contain strings and functions.",
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Asserts that a given value is a non-empty array.
|
|
131
|
+
* @param {*} value The value to check.
|
|
132
|
+
* @returns {void}
|
|
133
|
+
* @throws {TypeError} When the value is not an array or an empty array.
|
|
134
|
+
*/
|
|
135
|
+
function assertIsNonEmptyArray(value) {
|
|
136
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
137
|
+
throw new TypeError("Expected value to be a non-empty array.");
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
//------------------------------------------------------------------------------
|
|
142
|
+
// Exports
|
|
143
|
+
//------------------------------------------------------------------------------
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The schema for `files` and `ignores` that every ConfigArray uses.
|
|
147
|
+
* @type {ObjectDefinition}
|
|
148
|
+
*/
|
|
149
|
+
const filesAndIgnoresSchema = Object.freeze({
|
|
150
|
+
basePath: {
|
|
151
|
+
required: false,
|
|
152
|
+
merge() {
|
|
153
|
+
return undefined;
|
|
154
|
+
},
|
|
155
|
+
validate(value) {
|
|
156
|
+
if (typeof value !== "string") {
|
|
157
|
+
throw new TypeError("Expected value to be a string.");
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
files: {
|
|
162
|
+
required: false,
|
|
163
|
+
merge() {
|
|
164
|
+
return undefined;
|
|
165
|
+
},
|
|
166
|
+
validate(value) {
|
|
167
|
+
// first check if it's an array
|
|
168
|
+
assertIsNonEmptyArray(value);
|
|
169
|
+
|
|
170
|
+
// then check each member
|
|
171
|
+
value.forEach(item => {
|
|
172
|
+
if (Array.isArray(item)) {
|
|
173
|
+
assertIsArrayOfStringsAndFunctions(item);
|
|
174
|
+
} else if (
|
|
175
|
+
typeof item !== "string" &&
|
|
176
|
+
typeof item !== "function"
|
|
177
|
+
) {
|
|
178
|
+
throw new TypeError(
|
|
179
|
+
"Items must be a string, a function, or an array of strings and functions.",
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
ignores: {
|
|
186
|
+
required: false,
|
|
187
|
+
merge() {
|
|
188
|
+
return undefined;
|
|
189
|
+
},
|
|
190
|
+
validate: assertIsArrayOfStringsAndFunctions,
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @fileoverview ConfigArray
|
|
196
|
+
* @author Nicholas C. Zakas
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
//------------------------------------------------------------------------------
|
|
201
|
+
// Types
|
|
202
|
+
//------------------------------------------------------------------------------
|
|
203
|
+
|
|
204
|
+
/** @import * as $typests from "./types.ts"; */
|
|
205
|
+
/** @typedef {$typests.ConfigObject} ConfigObject */
|
|
206
|
+
/** @import * as $minimatch from "minimatch"; */
|
|
207
|
+
/** @typedef {$minimatch.MinimatchOptions} MinimatchOptions */
|
|
208
|
+
/** @import * as PathImpl from "@jsr/std__path" */
|
|
209
|
+
|
|
210
|
+
/*
|
|
211
|
+
* This is a bit of a hack to make TypeScript happy with the Rollup-created
|
|
212
|
+
* CommonJS file. Rollup doesn't do object destructuring for imported files
|
|
213
|
+
* and instead imports the default via `require()`. This messes up type checking
|
|
214
|
+
* for `ObjectSchema`. To work around that, we just import the type manually
|
|
215
|
+
* and give it a different name to use in the JSDoc comments.
|
|
216
|
+
*/
|
|
217
|
+
/** @typedef {ObjectSchema} ObjectSchemaInstance */
|
|
218
|
+
|
|
219
|
+
//------------------------------------------------------------------------------
|
|
220
|
+
// Helpers
|
|
221
|
+
//------------------------------------------------------------------------------
|
|
222
|
+
|
|
223
|
+
const debug = createDebug("@eslint/config-array");
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* A cache for minimatch instances.
|
|
227
|
+
* @type {Map<string, Minimatch>}
|
|
228
|
+
*/
|
|
229
|
+
const minimatchCache = new Map();
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* A cache for negated minimatch instances.
|
|
233
|
+
* @type {Map<string, Minimatch>}
|
|
234
|
+
*/
|
|
235
|
+
const negatedMinimatchCache = new Map();
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Options to use with minimatch.
|
|
239
|
+
* @type {MinimatchOptions}
|
|
240
|
+
*/
|
|
241
|
+
const MINIMATCH_OPTIONS = {
|
|
242
|
+
// matchBase: true,
|
|
243
|
+
dot: true,
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* The types of config objects that are supported.
|
|
248
|
+
* @type {Set<string>}
|
|
249
|
+
*/
|
|
250
|
+
const CONFIG_TYPES = new Set(["array", "function"]);
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Fields that are considered metadata and not part of the config object.
|
|
254
|
+
* @type {Set<string>}
|
|
255
|
+
*/
|
|
256
|
+
const META_FIELDS = new Set(["name", "basePath"]);
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* A schema containing just files and ignores for early validation.
|
|
260
|
+
* @type {ObjectSchemaInstance}
|
|
261
|
+
*/
|
|
262
|
+
const FILES_AND_IGNORES_SCHEMA = new objectSchema.ObjectSchema(filesAndIgnoresSchema);
|
|
263
|
+
|
|
264
|
+
// Precomputed constant objects returned by `ConfigArray.getConfigWithStatus`.
|
|
265
|
+
|
|
266
|
+
const CONFIG_WITH_STATUS_EXTERNAL = Object.freeze({ status: "external" });
|
|
267
|
+
const CONFIG_WITH_STATUS_IGNORED = Object.freeze({ status: "ignored" });
|
|
268
|
+
const CONFIG_WITH_STATUS_UNCONFIGURED = Object.freeze({
|
|
269
|
+
status: "unconfigured",
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
// Match two leading dots followed by a slash or the end of input.
|
|
273
|
+
const EXTERNAL_PATH_REGEX = /^\.\.(?:\/|$)/u;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Wrapper error for config validation errors that adds a name to the front of the
|
|
277
|
+
* error message.
|
|
278
|
+
*/
|
|
279
|
+
class ConfigError extends Error {
|
|
280
|
+
/**
|
|
281
|
+
* Creates a new instance.
|
|
282
|
+
* @param {string} name The config object name causing the error.
|
|
283
|
+
* @param {number} index The index of the config object in the array.
|
|
284
|
+
* @param {Object} options The options for the error.
|
|
285
|
+
* @param {Error} [options.cause] The error that caused this error.
|
|
286
|
+
* @param {string} [options.message] The message to use for the error.
|
|
287
|
+
*/
|
|
288
|
+
constructor(name, index, { cause, message }) {
|
|
289
|
+
const finalMessage = message || cause.message;
|
|
290
|
+
|
|
291
|
+
super(`Config ${name}: ${finalMessage}`, { cause });
|
|
292
|
+
|
|
293
|
+
// copy over custom properties that aren't represented
|
|
294
|
+
if (cause) {
|
|
295
|
+
for (const key of Object.keys(cause)) {
|
|
296
|
+
if (!(key in this)) {
|
|
297
|
+
this[key] = cause[key];
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* The name of the error.
|
|
304
|
+
* @type {string}
|
|
305
|
+
* @readonly
|
|
306
|
+
*/
|
|
307
|
+
this.name = "ConfigError";
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* The index of the config object in the array.
|
|
311
|
+
* @type {number}
|
|
312
|
+
* @readonly
|
|
313
|
+
*/
|
|
314
|
+
this.index = index;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Gets the name of a config object.
|
|
320
|
+
* @param {ConfigObject} config The config object to get the name of.
|
|
321
|
+
* @returns {string} The name of the config object.
|
|
322
|
+
*/
|
|
323
|
+
function getConfigName(config) {
|
|
324
|
+
if (config && typeof config.name === "string" && config.name) {
|
|
325
|
+
return `"${config.name}"`;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
return "(unnamed)";
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Rethrows a config error with additional information about the config object.
|
|
333
|
+
* @param {object} config The config object to get the name of.
|
|
334
|
+
* @param {number} index The index of the config object in the array.
|
|
335
|
+
* @param {Error} error The error to rethrow.
|
|
336
|
+
* @throws {ConfigError} When the error is rethrown for a config.
|
|
337
|
+
*/
|
|
338
|
+
function rethrowConfigError(config, index, error) {
|
|
339
|
+
const configName = getConfigName(config);
|
|
340
|
+
throw new ConfigError(configName, index, { cause: error });
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Shorthand for checking if a value is a string.
|
|
345
|
+
* @param {any} value The value to check.
|
|
346
|
+
* @returns {boolean} True if a string, false if not.
|
|
347
|
+
*/
|
|
348
|
+
function isString(value) {
|
|
349
|
+
return typeof value === "string";
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Creates a function that asserts that the config is valid
|
|
354
|
+
* during normalization. This checks that the config is not nullish
|
|
355
|
+
* and that files and ignores keys of a config object are valid as per base schema.
|
|
356
|
+
* @param {Object} config The config object to check.
|
|
357
|
+
* @param {number} index The index of the config object in the array.
|
|
358
|
+
* @returns {void}
|
|
359
|
+
* @throws {ConfigError} If the files and ignores keys of a config object are not valid.
|
|
360
|
+
*/
|
|
361
|
+
function assertValidBaseConfig(config, index) {
|
|
362
|
+
if (config === null) {
|
|
363
|
+
throw new ConfigError(getConfigName(config), index, {
|
|
364
|
+
message: "Unexpected null config.",
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (config === undefined) {
|
|
369
|
+
throw new ConfigError(getConfigName(config), index, {
|
|
370
|
+
message: "Unexpected undefined config.",
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (typeof config !== "object") {
|
|
375
|
+
throw new ConfigError(getConfigName(config), index, {
|
|
376
|
+
message: "Unexpected non-object config.",
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const validateConfig = {};
|
|
381
|
+
|
|
382
|
+
if ("basePath" in config) {
|
|
383
|
+
validateConfig.basePath = config.basePath;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
if ("files" in config) {
|
|
387
|
+
validateConfig.files = config.files;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if ("ignores" in config) {
|
|
391
|
+
validateConfig.ignores = config.ignores;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
try {
|
|
395
|
+
FILES_AND_IGNORES_SCHEMA.validate(validateConfig);
|
|
396
|
+
} catch (validationError) {
|
|
397
|
+
rethrowConfigError(config, index, validationError);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Wrapper around minimatch that caches minimatch patterns for
|
|
403
|
+
* faster matching speed over multiple file path evaluations.
|
|
404
|
+
* @param {string} filepath The file path to match.
|
|
405
|
+
* @param {string} pattern The glob pattern to match against.
|
|
406
|
+
* @param {object} options The minimatch options to use.
|
|
407
|
+
* @returns
|
|
408
|
+
*/
|
|
409
|
+
function doMatch(filepath, pattern, options = {}) {
|
|
410
|
+
let cache = minimatchCache;
|
|
411
|
+
|
|
412
|
+
if (options.flipNegate) {
|
|
413
|
+
cache = negatedMinimatchCache;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
let matcher = cache.get(pattern);
|
|
417
|
+
|
|
418
|
+
if (!matcher) {
|
|
419
|
+
matcher = new minimatch.Minimatch(
|
|
420
|
+
pattern,
|
|
421
|
+
Object.assign({}, MINIMATCH_OPTIONS, options),
|
|
422
|
+
);
|
|
423
|
+
cache.set(pattern, matcher);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return matcher.match(filepath);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Normalizes a pattern by removing the leading "./" if present.
|
|
431
|
+
* @param {string} pattern The pattern to normalize.
|
|
432
|
+
* @returns {string} The normalized pattern.
|
|
433
|
+
*/
|
|
434
|
+
function normalizePattern(pattern) {
|
|
435
|
+
if (isString(pattern)) {
|
|
436
|
+
if (pattern.startsWith("./")) {
|
|
437
|
+
return pattern.slice(2);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
if (pattern.startsWith("!./")) {
|
|
441
|
+
return `!${pattern.slice(3)}`;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
return pattern;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Checks if a given pattern requires normalization.
|
|
450
|
+
* @param {any} pattern The pattern to check.
|
|
451
|
+
* @returns {boolean} True if the pattern needs normalization, false otherwise.
|
|
452
|
+
*
|
|
453
|
+
*/
|
|
454
|
+
function needsPatternNormalization(pattern) {
|
|
455
|
+
return (
|
|
456
|
+
isString(pattern) &&
|
|
457
|
+
(pattern.startsWith("./") || pattern.startsWith("!./"))
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Normalizes `files` and `ignores` patterns in a config by removing "./" prefixes.
|
|
463
|
+
* @param {Object} config The config object to normalize patterns in.
|
|
464
|
+
* @param {string} namespacedBasePath The namespaced base path of the directory to which config base path is relative.
|
|
465
|
+
* @param {PathImpl} path Path-handling implementation.
|
|
466
|
+
* @returns {Object} The normalized config object.
|
|
467
|
+
*/
|
|
468
|
+
function normalizeConfigPatterns(config, namespacedBasePath, path) {
|
|
469
|
+
if (!config) {
|
|
470
|
+
return config;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
const hasBasePath = typeof config.basePath === "string";
|
|
474
|
+
|
|
475
|
+
let needsNormalization = false;
|
|
476
|
+
|
|
477
|
+
if (hasBasePath) {
|
|
478
|
+
needsNormalization = true;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
if (!needsNormalization && Array.isArray(config.files)) {
|
|
482
|
+
needsNormalization = config.files.some(pattern => {
|
|
483
|
+
if (Array.isArray(pattern)) {
|
|
484
|
+
return pattern.some(needsPatternNormalization);
|
|
485
|
+
}
|
|
486
|
+
return needsPatternNormalization(pattern);
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
if (!needsNormalization && Array.isArray(config.ignores)) {
|
|
491
|
+
needsNormalization = config.ignores.some(needsPatternNormalization);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
if (!needsNormalization) {
|
|
495
|
+
return config;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
const newConfig = { ...config };
|
|
499
|
+
|
|
500
|
+
if (hasBasePath) {
|
|
501
|
+
if (path.isAbsolute(config.basePath)) {
|
|
502
|
+
newConfig.basePath = path.toNamespacedPath(config.basePath);
|
|
503
|
+
} else {
|
|
504
|
+
newConfig.basePath = path.resolve(
|
|
505
|
+
namespacedBasePath,
|
|
506
|
+
config.basePath,
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
if (Array.isArray(newConfig.files)) {
|
|
512
|
+
newConfig.files = newConfig.files.map(pattern => {
|
|
513
|
+
if (Array.isArray(pattern)) {
|
|
514
|
+
return pattern.map(normalizePattern);
|
|
515
|
+
}
|
|
516
|
+
return normalizePattern(pattern);
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
if (Array.isArray(newConfig.ignores)) {
|
|
521
|
+
newConfig.ignores = newConfig.ignores.map(normalizePattern);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
return newConfig;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Normalizes a `ConfigArray` by flattening it and executing any functions
|
|
529
|
+
* that are found inside.
|
|
530
|
+
* @param {Array} items The items in a `ConfigArray`.
|
|
531
|
+
* @param {Object} context The context object to pass into any function
|
|
532
|
+
* found.
|
|
533
|
+
* @param {Array<string>} extraConfigTypes The config types to check.
|
|
534
|
+
* @param {string} namespacedBasePath The namespaced base path of the directory to which config base paths are relative.
|
|
535
|
+
* @param {PathImpl} path Path-handling implementation.
|
|
536
|
+
* @returns {Promise<Array>} A flattened array containing only config objects.
|
|
537
|
+
* @throws {TypeError} When a config function returns a function.
|
|
538
|
+
*/
|
|
539
|
+
async function normalize(
|
|
540
|
+
items,
|
|
541
|
+
context,
|
|
542
|
+
extraConfigTypes,
|
|
543
|
+
namespacedBasePath,
|
|
544
|
+
path,
|
|
545
|
+
) {
|
|
546
|
+
const allowFunctions = extraConfigTypes.includes("function");
|
|
547
|
+
const allowArrays = extraConfigTypes.includes("array");
|
|
548
|
+
|
|
549
|
+
async function* flatTraverse(array) {
|
|
550
|
+
for (let item of array) {
|
|
551
|
+
if (typeof item === "function") {
|
|
552
|
+
if (!allowFunctions) {
|
|
553
|
+
throw new TypeError("Unexpected function.");
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
item = item(context);
|
|
557
|
+
if (item.then) {
|
|
558
|
+
item = await item;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
if (Array.isArray(item)) {
|
|
563
|
+
if (!allowArrays) {
|
|
564
|
+
throw new TypeError("Unexpected array.");
|
|
565
|
+
}
|
|
566
|
+
yield* flatTraverse(item);
|
|
567
|
+
} else if (typeof item === "function") {
|
|
568
|
+
throw new TypeError(
|
|
569
|
+
"A config function can only return an object or array.",
|
|
570
|
+
);
|
|
571
|
+
} else {
|
|
572
|
+
yield item;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/*
|
|
578
|
+
* Async iterables cannot be used with the spread operator, so we need to manually
|
|
579
|
+
* create the array to return.
|
|
580
|
+
*/
|
|
581
|
+
const asyncIterable = await flatTraverse(items);
|
|
582
|
+
const configs = [];
|
|
583
|
+
|
|
584
|
+
for await (const config of asyncIterable) {
|
|
585
|
+
configs.push(normalizeConfigPatterns(config, namespacedBasePath, path));
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
return configs;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Normalizes a `ConfigArray` by flattening it and executing any functions
|
|
593
|
+
* that are found inside.
|
|
594
|
+
* @param {Array} items The items in a `ConfigArray`.
|
|
595
|
+
* @param {Object} context The context object to pass into any function
|
|
596
|
+
* found.
|
|
597
|
+
* @param {Array<string>} extraConfigTypes The config types to check.
|
|
598
|
+
* @param {string} namespacedBasePath The namespaced base path of the directory to which config base paths are relative.
|
|
599
|
+
* @param {PathImpl} path Path-handling implementation
|
|
600
|
+
* @returns {Array} A flattened array containing only config objects.
|
|
601
|
+
* @throws {TypeError} When a config function returns a function.
|
|
602
|
+
*/
|
|
603
|
+
function normalizeSync(
|
|
604
|
+
items,
|
|
605
|
+
context,
|
|
606
|
+
extraConfigTypes,
|
|
607
|
+
namespacedBasePath,
|
|
608
|
+
path,
|
|
609
|
+
) {
|
|
610
|
+
const allowFunctions = extraConfigTypes.includes("function");
|
|
611
|
+
const allowArrays = extraConfigTypes.includes("array");
|
|
612
|
+
|
|
613
|
+
function* flatTraverse(array) {
|
|
614
|
+
for (let item of array) {
|
|
615
|
+
if (typeof item === "function") {
|
|
616
|
+
if (!allowFunctions) {
|
|
617
|
+
throw new TypeError("Unexpected function.");
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
item = item(context);
|
|
621
|
+
if (item.then) {
|
|
622
|
+
throw new TypeError(
|
|
623
|
+
"Async config functions are not supported.",
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
if (Array.isArray(item)) {
|
|
629
|
+
if (!allowArrays) {
|
|
630
|
+
throw new TypeError("Unexpected array.");
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
yield* flatTraverse(item);
|
|
634
|
+
} else if (typeof item === "function") {
|
|
635
|
+
throw new TypeError(
|
|
636
|
+
"A config function can only return an object or array.",
|
|
637
|
+
);
|
|
638
|
+
} else {
|
|
639
|
+
yield item;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
const configs = [];
|
|
645
|
+
|
|
646
|
+
for (const config of flatTraverse(items)) {
|
|
647
|
+
configs.push(normalizeConfigPatterns(config, namespacedBasePath, path));
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
return configs;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Converts a given path to a relative path with all separator characters replaced by forward slashes (`"/"`).
|
|
655
|
+
* @param {string} fileOrDirPath The unprocessed path to convert.
|
|
656
|
+
* @param {string} namespacedBasePath The namespaced base path of the directory to which the calculated path shall be relative.
|
|
657
|
+
* @param {PathImpl} path Path-handling implementations.
|
|
658
|
+
* @returns {string} A relative path with all separator characters replaced by forward slashes.
|
|
659
|
+
*/
|
|
660
|
+
function toRelativePath(fileOrDirPath, namespacedBasePath, path) {
|
|
661
|
+
const fullPath = path.resolve(namespacedBasePath, fileOrDirPath);
|
|
662
|
+
const namespacedFullPath = path.toNamespacedPath(fullPath);
|
|
663
|
+
const relativePath = path.relative(namespacedBasePath, namespacedFullPath);
|
|
664
|
+
return relativePath.replaceAll(path.SEPARATOR, "/");
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Determines if a given file path should be ignored based on the given
|
|
669
|
+
* matcher.
|
|
670
|
+
* @param {Array<{ basePath?: string, ignores: Array<string|((string) => boolean)>}>} configs Configuration objects containing `ignores`.
|
|
671
|
+
* @param {string} filePath The unprocessed file path to check.
|
|
672
|
+
* @param {string} relativeFilePath The path of the file to check relative to the base path,
|
|
673
|
+
* using forward slash (`"/"`) as a separator.
|
|
674
|
+
* @param {Object} [basePathData] Additional data needed to recalculate paths for configuration objects
|
|
675
|
+
* that have `basePath` property.
|
|
676
|
+
* @param {string} [basePathData.basePath] Namespaced path to witch `relativeFilePath` is relative.
|
|
677
|
+
* @param {PathImpl} [basePathData.path] Path-handling implementation.
|
|
678
|
+
* @returns {boolean} True if the path should be ignored and false if not.
|
|
679
|
+
*/
|
|
680
|
+
function shouldIgnorePath(
|
|
681
|
+
configs,
|
|
682
|
+
filePath,
|
|
683
|
+
relativeFilePath,
|
|
684
|
+
{ basePath, path } = {},
|
|
685
|
+
) {
|
|
686
|
+
let shouldIgnore = false;
|
|
687
|
+
|
|
688
|
+
for (const config of configs) {
|
|
689
|
+
let relativeFilePathToCheck = relativeFilePath;
|
|
690
|
+
if (config.basePath) {
|
|
691
|
+
relativeFilePathToCheck = toRelativePath(
|
|
692
|
+
path.resolve(basePath, relativeFilePath),
|
|
693
|
+
config.basePath,
|
|
694
|
+
path,
|
|
695
|
+
);
|
|
696
|
+
|
|
697
|
+
if (
|
|
698
|
+
relativeFilePathToCheck === "" ||
|
|
699
|
+
EXTERNAL_PATH_REGEX.test(relativeFilePathToCheck)
|
|
700
|
+
) {
|
|
701
|
+
continue;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
if (relativeFilePath.endsWith("/")) {
|
|
705
|
+
relativeFilePathToCheck += "/";
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
shouldIgnore = config.ignores.reduce((ignored, matcher) => {
|
|
709
|
+
if (!ignored) {
|
|
710
|
+
if (typeof matcher === "function") {
|
|
711
|
+
return matcher(filePath);
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
// don't check negated patterns because we're not ignored yet
|
|
715
|
+
if (!matcher.startsWith("!")) {
|
|
716
|
+
return doMatch(relativeFilePathToCheck, matcher);
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
// otherwise we're still not ignored
|
|
720
|
+
return false;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
// only need to check negated patterns because we're ignored
|
|
724
|
+
if (typeof matcher === "string" && matcher.startsWith("!")) {
|
|
725
|
+
return !doMatch(relativeFilePathToCheck, matcher, {
|
|
726
|
+
flipNegate: true,
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
return ignored;
|
|
731
|
+
}, shouldIgnore);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
return shouldIgnore;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Determines if a given file path is matched by a config. If the config
|
|
739
|
+
* has no `files` field, then it matches; otherwise, if a `files` field
|
|
740
|
+
* is present then we match the globs in `files` and exclude any globs in
|
|
741
|
+
* `ignores`.
|
|
742
|
+
* @param {string} filePath The unprocessed file path to check.
|
|
743
|
+
* @param {string} relativeFilePath The path of the file to check relative to the base path,
|
|
744
|
+
* using forward slash (`"/"`) as a separator.
|
|
745
|
+
* @param {Object} config The config object to check.
|
|
746
|
+
* @returns {boolean} True if the file path is matched by the config,
|
|
747
|
+
* false if not.
|
|
748
|
+
*/
|
|
749
|
+
function pathMatches(filePath, relativeFilePath, config) {
|
|
750
|
+
// match both strings and functions
|
|
751
|
+
function match(pattern) {
|
|
752
|
+
if (isString(pattern)) {
|
|
753
|
+
return doMatch(relativeFilePath, pattern);
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
if (typeof pattern === "function") {
|
|
757
|
+
return pattern(filePath);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
throw new TypeError(`Unexpected matcher type ${pattern}.`);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
// check for all matches to config.files
|
|
764
|
+
let filePathMatchesPattern = config.files.some(pattern => {
|
|
765
|
+
if (Array.isArray(pattern)) {
|
|
766
|
+
return pattern.every(match);
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
return match(pattern);
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
/*
|
|
773
|
+
* If the file path matches the config.files patterns, then check to see
|
|
774
|
+
* if there are any files to ignore.
|
|
775
|
+
*/
|
|
776
|
+
if (filePathMatchesPattern && config.ignores) {
|
|
777
|
+
/*
|
|
778
|
+
* Pass config object without `basePath`, because `relativeFilePath` is already
|
|
779
|
+
* calculated as relative to it.
|
|
780
|
+
*/
|
|
781
|
+
filePathMatchesPattern = !shouldIgnorePath(
|
|
782
|
+
[{ ignores: config.ignores }],
|
|
783
|
+
filePath,
|
|
784
|
+
relativeFilePath,
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
return filePathMatchesPattern;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* Ensures that a ConfigArray has been normalized.
|
|
793
|
+
* @param {ConfigArray} configArray The ConfigArray to check.
|
|
794
|
+
* @returns {void}
|
|
795
|
+
* @throws {Error} When the `ConfigArray` is not normalized.
|
|
796
|
+
*/
|
|
797
|
+
function assertNormalized(configArray) {
|
|
798
|
+
// TODO: Throw more verbose error
|
|
799
|
+
if (!configArray.isNormalized()) {
|
|
800
|
+
throw new Error(
|
|
801
|
+
"ConfigArray must be normalized to perform this operation.",
|
|
802
|
+
);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Ensures that config types are valid.
|
|
808
|
+
* @param {Array<string>} extraConfigTypes The config types to check.
|
|
809
|
+
* @returns {void}
|
|
810
|
+
* @throws {TypeError} When the config types array is invalid.
|
|
811
|
+
*/
|
|
812
|
+
function assertExtraConfigTypes(extraConfigTypes) {
|
|
813
|
+
if (extraConfigTypes.length > 2) {
|
|
814
|
+
throw new TypeError(
|
|
815
|
+
"configTypes must be an array with at most two items.",
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
for (const configType of extraConfigTypes) {
|
|
820
|
+
if (!CONFIG_TYPES.has(configType)) {
|
|
821
|
+
throw new TypeError(
|
|
822
|
+
`Unexpected config type "${configType}" found. Expected one of: "object", "array", "function".`,
|
|
823
|
+
);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* Returns path-handling implementations for Unix or Windows, depending on a given absolute path.
|
|
830
|
+
* @param {string} fileOrDirPath The absolute path to check.
|
|
831
|
+
* @returns {PathImpl} Path-handling implementations for the specified path.
|
|
832
|
+
* @throws {Error} An error is thrown if the specified argument is not an absolute path.
|
|
833
|
+
*/
|
|
834
|
+
function getPathImpl(fileOrDirPath) {
|
|
835
|
+
// Posix absolute paths always start with a slash.
|
|
836
|
+
if (fileOrDirPath.startsWith("/")) {
|
|
837
|
+
return posixPath__namespace;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
// Windows absolute paths start with a letter followed by a colon and at least one backslash,
|
|
841
|
+
// or with two backslashes in the case of UNC paths.
|
|
842
|
+
// Forward slashed are automatically normalized to backslashes.
|
|
843
|
+
if (/^(?:[A-Za-z]:[/\\]|[/\\]{2})/u.test(fileOrDirPath)) {
|
|
844
|
+
return windowsPath__namespace;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
throw new Error(
|
|
848
|
+
`Expected an absolute path but received "${fileOrDirPath}"`,
|
|
849
|
+
);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
//------------------------------------------------------------------------------
|
|
853
|
+
// Public Interface
|
|
854
|
+
//------------------------------------------------------------------------------
|
|
855
|
+
|
|
856
|
+
const ConfigArraySymbol = {
|
|
857
|
+
isNormalized: Symbol("isNormalized"),
|
|
858
|
+
configCache: Symbol("configCache"),
|
|
859
|
+
schema: Symbol("schema"),
|
|
860
|
+
finalizeConfig: Symbol("finalizeConfig"),
|
|
861
|
+
preprocessConfig: Symbol("preprocessConfig"),
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
// used to store calculate data for faster lookup
|
|
865
|
+
const dataCache = new WeakMap();
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Represents an array of config objects and provides method for working with
|
|
869
|
+
* those config objects.
|
|
870
|
+
*/
|
|
871
|
+
class ConfigArray extends Array {
|
|
872
|
+
/**
|
|
873
|
+
* The namespaced path of the config file directory.
|
|
874
|
+
* @type {string}
|
|
875
|
+
*/
|
|
876
|
+
#namespacedBasePath;
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Path-handling implementations.
|
|
880
|
+
* @type {PathImpl}
|
|
881
|
+
*/
|
|
882
|
+
#path;
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Creates a new instance of ConfigArray.
|
|
886
|
+
* @param {Iterable|Function|Object} configs An iterable yielding config
|
|
887
|
+
* objects, or a config function, or a config object.
|
|
888
|
+
* @param {Object} options The options for the ConfigArray.
|
|
889
|
+
* @param {string} [options.basePath="/"] The absolute path of the config file directory.
|
|
890
|
+
* Defaults to `"/"`.
|
|
891
|
+
* @param {boolean} [options.normalized=false] Flag indicating if the
|
|
892
|
+
* configs have already been normalized.
|
|
893
|
+
* @param {Object} [options.schema] The additional schema
|
|
894
|
+
* definitions to use for the ConfigArray schema.
|
|
895
|
+
* @param {Array<string>} [options.extraConfigTypes] List of config types supported.
|
|
896
|
+
* @throws {TypeError} When the `basePath` is not a non-empty string,
|
|
897
|
+
*/
|
|
898
|
+
constructor(
|
|
899
|
+
configs,
|
|
900
|
+
{
|
|
901
|
+
basePath = "/",
|
|
902
|
+
normalized = false,
|
|
903
|
+
schema: customSchema,
|
|
904
|
+
extraConfigTypes = [],
|
|
905
|
+
} = {},
|
|
906
|
+
) {
|
|
907
|
+
super();
|
|
908
|
+
|
|
909
|
+
/**
|
|
910
|
+
* Tracks if the array has been normalized.
|
|
911
|
+
* @property isNormalized
|
|
912
|
+
* @type {boolean}
|
|
913
|
+
* @private
|
|
914
|
+
*/
|
|
915
|
+
this[ConfigArraySymbol.isNormalized] = normalized;
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* The schema used for validating and merging configs.
|
|
919
|
+
* @property schema
|
|
920
|
+
* @type {ObjectSchemaInstance}
|
|
921
|
+
* @private
|
|
922
|
+
*/
|
|
923
|
+
this[ConfigArraySymbol.schema] = new objectSchema.ObjectSchema(
|
|
924
|
+
Object.assign({}, customSchema, baseSchema),
|
|
925
|
+
);
|
|
926
|
+
|
|
927
|
+
if (!isString(basePath) || !basePath) {
|
|
928
|
+
throw new TypeError("basePath must be a non-empty string");
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* The path of the config file that this array was loaded from.
|
|
933
|
+
* This is used to calculate filename matches.
|
|
934
|
+
* @property basePath
|
|
935
|
+
* @type {string}
|
|
936
|
+
*/
|
|
937
|
+
this.basePath = basePath;
|
|
938
|
+
|
|
939
|
+
assertExtraConfigTypes(extraConfigTypes);
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* The supported config types.
|
|
943
|
+
* @type {Array<string>}
|
|
944
|
+
*/
|
|
945
|
+
this.extraConfigTypes = [...extraConfigTypes];
|
|
946
|
+
Object.freeze(this.extraConfigTypes);
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* A cache to store calculated configs for faster repeat lookup.
|
|
950
|
+
* @property configCache
|
|
951
|
+
* @type {Map<string, Object>}
|
|
952
|
+
* @private
|
|
953
|
+
*/
|
|
954
|
+
this[ConfigArraySymbol.configCache] = new Map();
|
|
955
|
+
|
|
956
|
+
// init cache
|
|
957
|
+
dataCache.set(this, {
|
|
958
|
+
explicitMatches: new Map(),
|
|
959
|
+
directoryMatches: new Map(),
|
|
960
|
+
files: undefined,
|
|
961
|
+
ignores: undefined,
|
|
962
|
+
});
|
|
963
|
+
|
|
964
|
+
// load the configs into this array
|
|
965
|
+
if (Array.isArray(configs)) {
|
|
966
|
+
this.push(...configs);
|
|
967
|
+
} else {
|
|
968
|
+
this.push(configs);
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
// select path-handling implementations depending on the base path
|
|
972
|
+
this.#path = getPathImpl(basePath);
|
|
973
|
+
|
|
974
|
+
// On Windows, `path.relative()` returns an absolute path when given two paths on different drives.
|
|
975
|
+
// The namespaced base path is useful to make sure that calculated relative paths are always relative.
|
|
976
|
+
// On Unix, it is identical to the base path.
|
|
977
|
+
this.#namespacedBasePath = this.#path.toNamespacedPath(basePath);
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
/**
|
|
981
|
+
* Prevent normal array methods from creating a new `ConfigArray` instance.
|
|
982
|
+
* This is to ensure that methods such as `slice()` won't try to create a
|
|
983
|
+
* new instance of `ConfigArray` behind the scenes as doing so may throw
|
|
984
|
+
* an error due to the different constructor signature.
|
|
985
|
+
* @type {ArrayConstructor} The `Array` constructor.
|
|
986
|
+
*/
|
|
987
|
+
static get [Symbol.species]() {
|
|
988
|
+
return Array;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
/**
|
|
992
|
+
* Returns the `files` globs from every config object in the array.
|
|
993
|
+
* This can be used to determine which files will be matched by a
|
|
994
|
+
* config array or to use as a glob pattern when no patterns are provided
|
|
995
|
+
* for a command line interface.
|
|
996
|
+
* @returns {Array<string|Function>} An array of matchers.
|
|
997
|
+
*/
|
|
998
|
+
get files() {
|
|
999
|
+
assertNormalized(this);
|
|
1000
|
+
|
|
1001
|
+
// if this data has been cached, retrieve it
|
|
1002
|
+
const cache = dataCache.get(this);
|
|
1003
|
+
|
|
1004
|
+
if (cache.files) {
|
|
1005
|
+
return cache.files;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
// otherwise calculate it
|
|
1009
|
+
|
|
1010
|
+
const result = [];
|
|
1011
|
+
|
|
1012
|
+
for (const config of this) {
|
|
1013
|
+
if (config.files) {
|
|
1014
|
+
config.files.forEach(filePattern => {
|
|
1015
|
+
result.push(filePattern);
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
// store result
|
|
1021
|
+
cache.files = result;
|
|
1022
|
+
dataCache.set(this, cache);
|
|
1023
|
+
|
|
1024
|
+
return result;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
/**
|
|
1028
|
+
* Returns ignore matchers that should always be ignored regardless of
|
|
1029
|
+
* the matching `files` fields in any configs. This is necessary to mimic
|
|
1030
|
+
* the behavior of things like .gitignore and .eslintignore, allowing a
|
|
1031
|
+
* globbing operation to be faster.
|
|
1032
|
+
* @returns {Object[]} An array of config objects representing global ignores.
|
|
1033
|
+
*/
|
|
1034
|
+
get ignores() {
|
|
1035
|
+
assertNormalized(this);
|
|
1036
|
+
|
|
1037
|
+
// if this data has been cached, retrieve it
|
|
1038
|
+
const cache = dataCache.get(this);
|
|
1039
|
+
|
|
1040
|
+
if (cache.ignores) {
|
|
1041
|
+
return cache.ignores;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
// otherwise calculate it
|
|
1045
|
+
|
|
1046
|
+
const result = [];
|
|
1047
|
+
|
|
1048
|
+
for (const config of this) {
|
|
1049
|
+
/*
|
|
1050
|
+
* We only count ignores if there are no other keys in the object.
|
|
1051
|
+
* In this case, it acts list a globally ignored pattern. If there
|
|
1052
|
+
* are additional keys, then ignores act like exclusions.
|
|
1053
|
+
*/
|
|
1054
|
+
if (
|
|
1055
|
+
config.ignores &&
|
|
1056
|
+
Object.keys(config).filter(key => !META_FIELDS.has(key))
|
|
1057
|
+
.length === 1
|
|
1058
|
+
) {
|
|
1059
|
+
result.push(config);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
// store result
|
|
1064
|
+
cache.ignores = result;
|
|
1065
|
+
dataCache.set(this, cache);
|
|
1066
|
+
|
|
1067
|
+
return result;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
/**
|
|
1071
|
+
* Indicates if the config array has been normalized.
|
|
1072
|
+
* @returns {boolean} True if the config array is normalized, false if not.
|
|
1073
|
+
*/
|
|
1074
|
+
isNormalized() {
|
|
1075
|
+
return this[ConfigArraySymbol.isNormalized];
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* Normalizes a config array by flattening embedded arrays and executing
|
|
1080
|
+
* config functions.
|
|
1081
|
+
* @param {Object} [context] The context object for config functions.
|
|
1082
|
+
* @returns {Promise<ConfigArray>} The current ConfigArray instance.
|
|
1083
|
+
*/
|
|
1084
|
+
async normalize(context = {}) {
|
|
1085
|
+
if (!this.isNormalized()) {
|
|
1086
|
+
const normalizedConfigs = await normalize(
|
|
1087
|
+
this,
|
|
1088
|
+
context,
|
|
1089
|
+
this.extraConfigTypes,
|
|
1090
|
+
this.#namespacedBasePath,
|
|
1091
|
+
this.#path,
|
|
1092
|
+
);
|
|
1093
|
+
this.length = 0;
|
|
1094
|
+
this.push(
|
|
1095
|
+
...normalizedConfigs.map(
|
|
1096
|
+
this[ConfigArraySymbol.preprocessConfig].bind(this),
|
|
1097
|
+
),
|
|
1098
|
+
);
|
|
1099
|
+
this.forEach(assertValidBaseConfig);
|
|
1100
|
+
this[ConfigArraySymbol.isNormalized] = true;
|
|
1101
|
+
|
|
1102
|
+
// prevent further changes
|
|
1103
|
+
Object.freeze(this);
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
return this;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* Normalizes a config array by flattening embedded arrays and executing
|
|
1111
|
+
* config functions.
|
|
1112
|
+
* @param {Object} [context] The context object for config functions.
|
|
1113
|
+
* @returns {ConfigArray} The current ConfigArray instance.
|
|
1114
|
+
*/
|
|
1115
|
+
normalizeSync(context = {}) {
|
|
1116
|
+
if (!this.isNormalized()) {
|
|
1117
|
+
const normalizedConfigs = normalizeSync(
|
|
1118
|
+
this,
|
|
1119
|
+
context,
|
|
1120
|
+
this.extraConfigTypes,
|
|
1121
|
+
this.#namespacedBasePath,
|
|
1122
|
+
this.#path,
|
|
1123
|
+
);
|
|
1124
|
+
this.length = 0;
|
|
1125
|
+
this.push(
|
|
1126
|
+
...normalizedConfigs.map(
|
|
1127
|
+
this[ConfigArraySymbol.preprocessConfig].bind(this),
|
|
1128
|
+
),
|
|
1129
|
+
);
|
|
1130
|
+
this.forEach(assertValidBaseConfig);
|
|
1131
|
+
this[ConfigArraySymbol.isNormalized] = true;
|
|
1132
|
+
|
|
1133
|
+
// prevent further changes
|
|
1134
|
+
Object.freeze(this);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
return this;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
/* eslint-disable class-methods-use-this -- Desired as instance methods */
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* Finalizes the state of a config before being cached and returned by
|
|
1144
|
+
* `getConfig()`. Does nothing by default but is provided to be
|
|
1145
|
+
* overridden by subclasses as necessary.
|
|
1146
|
+
* @param {Object} config The config to finalize.
|
|
1147
|
+
* @returns {Object} The finalized config.
|
|
1148
|
+
*/
|
|
1149
|
+
// Cast key to `never` to prevent TypeScript from adding the signature `[x: symbol]: (config: any) => any` to the type of the class.
|
|
1150
|
+
[/** @type {never} */ (ConfigArraySymbol.finalizeConfig)](config) {
|
|
1151
|
+
return config;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* Preprocesses a config during the normalization process. This is the
|
|
1156
|
+
* method to override if you want to convert an array item before it is
|
|
1157
|
+
* validated for the first time. For example, if you want to replace a
|
|
1158
|
+
* string with an object, this is the method to override.
|
|
1159
|
+
* @param {Object} config The config to preprocess.
|
|
1160
|
+
* @returns {Object} The config to use in place of the argument.
|
|
1161
|
+
*/
|
|
1162
|
+
// Cast key to `never` to prevent TypeScript from adding the signature `[x: symbol]: (config: any) => any` to the type of the class.
|
|
1163
|
+
[/** @type {never} */ (ConfigArraySymbol.preprocessConfig)](config) {
|
|
1164
|
+
return config;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
/* eslint-enable class-methods-use-this -- Desired as instance methods */
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* Returns the config object for a given file path and a status that can be used to determine why a file has no config.
|
|
1171
|
+
* @param {string} filePath The path of a file to get a config for.
|
|
1172
|
+
* @returns {{ config?: Object, status: "ignored"|"external"|"unconfigured"|"matched" }}
|
|
1173
|
+
* An object with an optional property `config` and property `status`.
|
|
1174
|
+
* `config` is the config object for the specified file as returned by {@linkcode ConfigArray.getConfig},
|
|
1175
|
+
* `status` a is one of the constants returned by {@linkcode ConfigArray.getConfigStatus}.
|
|
1176
|
+
*/
|
|
1177
|
+
getConfigWithStatus(filePath) {
|
|
1178
|
+
assertNormalized(this);
|
|
1179
|
+
|
|
1180
|
+
const cache = this[ConfigArraySymbol.configCache];
|
|
1181
|
+
|
|
1182
|
+
// first check the cache for a filename match to avoid duplicate work
|
|
1183
|
+
if (cache.has(filePath)) {
|
|
1184
|
+
return cache.get(filePath);
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
// check to see if the file is outside the base path
|
|
1188
|
+
|
|
1189
|
+
const relativeToBaseFilePath = toRelativePath(
|
|
1190
|
+
filePath,
|
|
1191
|
+
this.#namespacedBasePath,
|
|
1192
|
+
this.#path,
|
|
1193
|
+
);
|
|
1194
|
+
|
|
1195
|
+
if (EXTERNAL_PATH_REGEX.test(relativeToBaseFilePath)) {
|
|
1196
|
+
debug(`No config for file ${filePath} outside of base path`);
|
|
1197
|
+
|
|
1198
|
+
// cache and return result
|
|
1199
|
+
cache.set(filePath, CONFIG_WITH_STATUS_EXTERNAL);
|
|
1200
|
+
return CONFIG_WITH_STATUS_EXTERNAL;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
// next check to see if the file should be ignored
|
|
1204
|
+
|
|
1205
|
+
// check if this should be ignored due to its directory
|
|
1206
|
+
if (this.isDirectoryIgnored(this.#path.dirname(filePath))) {
|
|
1207
|
+
debug(`Ignoring ${filePath} based on directory pattern`);
|
|
1208
|
+
|
|
1209
|
+
// cache and return result
|
|
1210
|
+
cache.set(filePath, CONFIG_WITH_STATUS_IGNORED);
|
|
1211
|
+
return CONFIG_WITH_STATUS_IGNORED;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
if (
|
|
1215
|
+
shouldIgnorePath(this.ignores, filePath, relativeToBaseFilePath, {
|
|
1216
|
+
basePath: this.#namespacedBasePath,
|
|
1217
|
+
path: this.#path,
|
|
1218
|
+
})
|
|
1219
|
+
) {
|
|
1220
|
+
debug(`Ignoring ${filePath} based on file pattern`);
|
|
1221
|
+
|
|
1222
|
+
// cache and return result
|
|
1223
|
+
cache.set(filePath, CONFIG_WITH_STATUS_IGNORED);
|
|
1224
|
+
return CONFIG_WITH_STATUS_IGNORED;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
// filePath isn't automatically ignored, so try to construct config
|
|
1228
|
+
|
|
1229
|
+
const matchingConfigIndices = [];
|
|
1230
|
+
let matchFound = false;
|
|
1231
|
+
const universalPattern = /^\*$|^!|\/\*{1,2}$/u;
|
|
1232
|
+
|
|
1233
|
+
this.forEach((config, index) => {
|
|
1234
|
+
const relativeFilePath = config.basePath
|
|
1235
|
+
? toRelativePath(
|
|
1236
|
+
this.#path.resolve(this.#namespacedBasePath, filePath),
|
|
1237
|
+
config.basePath,
|
|
1238
|
+
this.#path,
|
|
1239
|
+
)
|
|
1240
|
+
: relativeToBaseFilePath;
|
|
1241
|
+
|
|
1242
|
+
if (config.basePath && EXTERNAL_PATH_REGEX.test(relativeFilePath)) {
|
|
1243
|
+
debug(
|
|
1244
|
+
`Skipped config found for ${filePath} (based on config's base path: ${config.basePath}`,
|
|
1245
|
+
);
|
|
1246
|
+
return;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
if (!config.files) {
|
|
1250
|
+
if (!config.ignores) {
|
|
1251
|
+
debug(`Universal config found for ${filePath}`);
|
|
1252
|
+
matchingConfigIndices.push(index);
|
|
1253
|
+
return;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
if (
|
|
1257
|
+
Object.keys(config).filter(key => !META_FIELDS.has(key))
|
|
1258
|
+
.length === 1
|
|
1259
|
+
) {
|
|
1260
|
+
debug(
|
|
1261
|
+
`Skipped config found for ${filePath} (global ignores)`,
|
|
1262
|
+
);
|
|
1263
|
+
return;
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
/*
|
|
1267
|
+
* Pass config object without `basePath`, because `relativeFilePath` is already
|
|
1268
|
+
* calculated as relative to it.
|
|
1269
|
+
*/
|
|
1270
|
+
if (
|
|
1271
|
+
shouldIgnorePath(
|
|
1272
|
+
[{ ignores: config.ignores }],
|
|
1273
|
+
filePath,
|
|
1274
|
+
relativeFilePath,
|
|
1275
|
+
)
|
|
1276
|
+
) {
|
|
1277
|
+
debug(
|
|
1278
|
+
`Skipped config found for ${filePath} (based on ignores: ${config.ignores})`,
|
|
1279
|
+
);
|
|
1280
|
+
return;
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
debug(
|
|
1284
|
+
`Matching config found for ${filePath} (based on ignores: ${config.ignores})`,
|
|
1285
|
+
);
|
|
1286
|
+
matchingConfigIndices.push(index);
|
|
1287
|
+
return;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
/*
|
|
1291
|
+
* If a config has a files pattern * or patterns ending in /** or /*,
|
|
1292
|
+
* and the filePath only matches those patterns, then the config is only
|
|
1293
|
+
* applied if there is another config where the filePath matches
|
|
1294
|
+
* a file with a specific extensions such as *.js.
|
|
1295
|
+
*/
|
|
1296
|
+
|
|
1297
|
+
const nonUniversalFiles = [];
|
|
1298
|
+
const universalFiles = config.files.filter(element => {
|
|
1299
|
+
if (Array.isArray(element)) {
|
|
1300
|
+
/*
|
|
1301
|
+
* filePath matches an element that is an array only if it matches
|
|
1302
|
+
* all patterns in it (AND operation). Therefore, if there is at least
|
|
1303
|
+
* one non-universal pattern in the array, and filePath matches the array,
|
|
1304
|
+
* then we know for sure that filePath matches at least one non-universal
|
|
1305
|
+
* pattern, so we can consider the entire array to be non-universal.
|
|
1306
|
+
* In other words, all patterns in the array need to be universal
|
|
1307
|
+
* for it to be considered universal.
|
|
1308
|
+
*/
|
|
1309
|
+
if (
|
|
1310
|
+
element.every(pattern => universalPattern.test(pattern))
|
|
1311
|
+
) {
|
|
1312
|
+
return true;
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
nonUniversalFiles.push(element);
|
|
1316
|
+
return false;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
// element is a string
|
|
1320
|
+
|
|
1321
|
+
if (universalPattern.test(element)) {
|
|
1322
|
+
return true;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
nonUniversalFiles.push(element);
|
|
1326
|
+
return false;
|
|
1327
|
+
});
|
|
1328
|
+
|
|
1329
|
+
// universal patterns were found so we need to check the config twice
|
|
1330
|
+
if (universalFiles.length) {
|
|
1331
|
+
debug("Universal files patterns found. Checking carefully.");
|
|
1332
|
+
|
|
1333
|
+
// check that the config matches without the non-universal files first
|
|
1334
|
+
if (
|
|
1335
|
+
nonUniversalFiles.length &&
|
|
1336
|
+
pathMatches(filePath, relativeFilePath, {
|
|
1337
|
+
files: nonUniversalFiles,
|
|
1338
|
+
ignores: config.ignores,
|
|
1339
|
+
})
|
|
1340
|
+
) {
|
|
1341
|
+
debug(`Matching config found for ${filePath}`);
|
|
1342
|
+
matchingConfigIndices.push(index);
|
|
1343
|
+
matchFound = true;
|
|
1344
|
+
return;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
// if there wasn't a match then check if it matches with universal files
|
|
1348
|
+
if (
|
|
1349
|
+
universalFiles.length &&
|
|
1350
|
+
pathMatches(filePath, relativeFilePath, {
|
|
1351
|
+
files: universalFiles,
|
|
1352
|
+
ignores: config.ignores,
|
|
1353
|
+
})
|
|
1354
|
+
) {
|
|
1355
|
+
debug(`Matching config found for ${filePath}`);
|
|
1356
|
+
matchingConfigIndices.push(index);
|
|
1357
|
+
return;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
// if we make here, then there was no match
|
|
1361
|
+
return;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
// the normal case
|
|
1365
|
+
if (pathMatches(filePath, relativeFilePath, config)) {
|
|
1366
|
+
debug(`Matching config found for ${filePath}`);
|
|
1367
|
+
matchingConfigIndices.push(index);
|
|
1368
|
+
matchFound = true;
|
|
1369
|
+
}
|
|
1370
|
+
});
|
|
1371
|
+
|
|
1372
|
+
// if matching both files and ignores, there will be no config to create
|
|
1373
|
+
if (!matchFound) {
|
|
1374
|
+
debug(`No matching configs found for ${filePath}`);
|
|
1375
|
+
|
|
1376
|
+
// cache and return result
|
|
1377
|
+
cache.set(filePath, CONFIG_WITH_STATUS_UNCONFIGURED);
|
|
1378
|
+
return CONFIG_WITH_STATUS_UNCONFIGURED;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
// check to see if there is a config cached by indices
|
|
1382
|
+
const indicesKey = matchingConfigIndices.toString();
|
|
1383
|
+
let configWithStatus = cache.get(indicesKey);
|
|
1384
|
+
|
|
1385
|
+
if (configWithStatus) {
|
|
1386
|
+
// also store for filename for faster lookup next time
|
|
1387
|
+
cache.set(filePath, configWithStatus);
|
|
1388
|
+
|
|
1389
|
+
return configWithStatus;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
// otherwise construct the config
|
|
1393
|
+
|
|
1394
|
+
// eslint-disable-next-line array-callback-return, consistent-return -- rethrowConfigError always throws an error
|
|
1395
|
+
let finalConfig = matchingConfigIndices.reduce((result, index) => {
|
|
1396
|
+
try {
|
|
1397
|
+
return this[ConfigArraySymbol.schema].merge(
|
|
1398
|
+
result,
|
|
1399
|
+
this[index],
|
|
1400
|
+
);
|
|
1401
|
+
} catch (validationError) {
|
|
1402
|
+
rethrowConfigError(this[index], index, validationError);
|
|
1403
|
+
}
|
|
1404
|
+
}, {});
|
|
1405
|
+
|
|
1406
|
+
finalConfig = this[ConfigArraySymbol.finalizeConfig](finalConfig);
|
|
1407
|
+
|
|
1408
|
+
configWithStatus = Object.freeze({
|
|
1409
|
+
config: finalConfig,
|
|
1410
|
+
status: "matched",
|
|
1411
|
+
});
|
|
1412
|
+
cache.set(filePath, configWithStatus);
|
|
1413
|
+
cache.set(indicesKey, configWithStatus);
|
|
1414
|
+
|
|
1415
|
+
return configWithStatus;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
/**
|
|
1419
|
+
* Returns the config object for a given file path.
|
|
1420
|
+
* @param {string} filePath The path of a file to get a config for.
|
|
1421
|
+
* @returns {Object|undefined} The config object for this file or `undefined`.
|
|
1422
|
+
*/
|
|
1423
|
+
getConfig(filePath) {
|
|
1424
|
+
return this.getConfigWithStatus(filePath).config;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
/**
|
|
1428
|
+
* Determines whether a file has a config or why it doesn't.
|
|
1429
|
+
* @param {string} filePath The path of the file to check.
|
|
1430
|
+
* @returns {"ignored"|"external"|"unconfigured"|"matched"} One of the following values:
|
|
1431
|
+
* * `"ignored"`: the file is ignored
|
|
1432
|
+
* * `"external"`: the file is outside the base path
|
|
1433
|
+
* * `"unconfigured"`: the file is not matched by any config
|
|
1434
|
+
* * `"matched"`: the file has a matching config
|
|
1435
|
+
*/
|
|
1436
|
+
getConfigStatus(filePath) {
|
|
1437
|
+
return this.getConfigWithStatus(filePath).status;
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
/**
|
|
1441
|
+
* Determines if the given filepath is ignored based on the configs.
|
|
1442
|
+
* @param {string} filePath The path of a file to check.
|
|
1443
|
+
* @returns {boolean} True if the path is ignored, false if not.
|
|
1444
|
+
* @deprecated Use `isFileIgnored` instead.
|
|
1445
|
+
*/
|
|
1446
|
+
isIgnored(filePath) {
|
|
1447
|
+
return this.isFileIgnored(filePath);
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
/**
|
|
1451
|
+
* Determines if the given filepath is ignored based on the configs.
|
|
1452
|
+
* @param {string} filePath The path of a file to check.
|
|
1453
|
+
* @returns {boolean} True if the path is ignored, false if not.
|
|
1454
|
+
*/
|
|
1455
|
+
isFileIgnored(filePath) {
|
|
1456
|
+
return this.getConfigStatus(filePath) === "ignored";
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
/**
|
|
1460
|
+
* Determines if the given directory is ignored based on the configs.
|
|
1461
|
+
* This checks only default `ignores` that don't have `files` in the
|
|
1462
|
+
* same config. A pattern such as `/foo` be considered to ignore the directory
|
|
1463
|
+
* while a pattern such as `/foo/**` is not considered to ignore the
|
|
1464
|
+
* directory because it is matching files.
|
|
1465
|
+
* @param {string} directoryPath The path of a directory to check.
|
|
1466
|
+
* @returns {boolean} True if the directory is ignored, false if not. Will
|
|
1467
|
+
* return true for any directory that is not inside of `basePath`.
|
|
1468
|
+
* @throws {Error} When the `ConfigArray` is not normalized.
|
|
1469
|
+
*/
|
|
1470
|
+
isDirectoryIgnored(directoryPath) {
|
|
1471
|
+
assertNormalized(this);
|
|
1472
|
+
|
|
1473
|
+
const relativeDirectoryPath = toRelativePath(
|
|
1474
|
+
directoryPath,
|
|
1475
|
+
this.#namespacedBasePath,
|
|
1476
|
+
this.#path,
|
|
1477
|
+
);
|
|
1478
|
+
|
|
1479
|
+
// basePath directory can never be ignored
|
|
1480
|
+
if (relativeDirectoryPath === "") {
|
|
1481
|
+
return false;
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
if (EXTERNAL_PATH_REGEX.test(relativeDirectoryPath)) {
|
|
1485
|
+
return true;
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
// first check the cache
|
|
1489
|
+
const cache = dataCache.get(this).directoryMatches;
|
|
1490
|
+
|
|
1491
|
+
if (cache.has(relativeDirectoryPath)) {
|
|
1492
|
+
return cache.get(relativeDirectoryPath);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
const directoryParts = relativeDirectoryPath.split("/");
|
|
1496
|
+
let relativeDirectoryToCheck = "";
|
|
1497
|
+
let result;
|
|
1498
|
+
|
|
1499
|
+
/*
|
|
1500
|
+
* In order to get the correct gitignore-style ignores, where an
|
|
1501
|
+
* ignored parent directory cannot have any descendants unignored,
|
|
1502
|
+
* we need to check every directory starting at the parent all
|
|
1503
|
+
* the way down to the actual requested directory.
|
|
1504
|
+
*
|
|
1505
|
+
* We aggressively cache all of this info to make sure we don't
|
|
1506
|
+
* have to recalculate everything for every call.
|
|
1507
|
+
*/
|
|
1508
|
+
do {
|
|
1509
|
+
relativeDirectoryToCheck += `${directoryParts.shift()}/`;
|
|
1510
|
+
|
|
1511
|
+
result = shouldIgnorePath(
|
|
1512
|
+
this.ignores,
|
|
1513
|
+
this.#path.join(this.basePath, relativeDirectoryToCheck),
|
|
1514
|
+
relativeDirectoryToCheck,
|
|
1515
|
+
{
|
|
1516
|
+
basePath: this.#namespacedBasePath,
|
|
1517
|
+
path: this.#path,
|
|
1518
|
+
},
|
|
1519
|
+
);
|
|
1520
|
+
|
|
1521
|
+
cache.set(relativeDirectoryToCheck, result);
|
|
1522
|
+
} while (!result && directoryParts.length);
|
|
1523
|
+
|
|
1524
|
+
// also cache the result for the requested path
|
|
1525
|
+
cache.set(relativeDirectoryPath, result);
|
|
1526
|
+
|
|
1527
|
+
return result;
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
Object.defineProperty(exports, "ObjectSchema", {
|
|
1532
|
+
enumerable: true,
|
|
1533
|
+
get: function () { return objectSchema.ObjectSchema; }
|
|
1534
|
+
});
|
|
1535
|
+
exports.ConfigArray = ConfigArray;
|
|
1536
|
+
exports.ConfigArraySymbol = ConfigArraySymbol;
|