@alexlit/lint-kit 173.3.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 +7 -7
|
@@ -0,0 +1,1272 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var acorn = require('acorn');
|
|
6
|
+
var jsx = require('acorn-jsx');
|
|
7
|
+
var visitorKeys = require('eslint-visitor-keys');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
function _interopNamespace(e) {
|
|
12
|
+
if (e && e.__esModule) return e;
|
|
13
|
+
var n = Object.create(null);
|
|
14
|
+
if (e) {
|
|
15
|
+
Object.keys(e).forEach(function (k) {
|
|
16
|
+
if (k !== 'default') {
|
|
17
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return e[k]; }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
n["default"] = e;
|
|
26
|
+
return Object.freeze(n);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var acorn__namespace = /*#__PURE__*/_interopNamespace(acorn);
|
|
30
|
+
var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx);
|
|
31
|
+
var visitorKeys__namespace = /*#__PURE__*/_interopNamespace(visitorKeys);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @fileoverview Translates tokens between Acorn format and Esprima format.
|
|
35
|
+
* @author Nicholas C. Zakas
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @import * as acorn from "acorn";
|
|
40
|
+
* @import { EnhancedTokTypes } from "./espree.js"
|
|
41
|
+
* @import { NormalizedEcmaVersion } from "./options.js";
|
|
42
|
+
* @import { EspreeToken as EsprimaToken } from "../espree.js";
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* Based on the `acorn.Token` class, but without a fixed `type` (since we need
|
|
46
|
+
* it to be a string). Avoiding `type` lets us make one extending interface
|
|
47
|
+
* more strict and another more lax.
|
|
48
|
+
*
|
|
49
|
+
* We could make `value` more strict to `string` even though the original is
|
|
50
|
+
* `any`.
|
|
51
|
+
*
|
|
52
|
+
* `start` and `end` are required in `acorn.Token`
|
|
53
|
+
*
|
|
54
|
+
* `loc` and `range` are from `acorn.Token`
|
|
55
|
+
*
|
|
56
|
+
* Adds `regex`.
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
59
|
+
* @typedef {{
|
|
60
|
+
* jsxAttrValueToken: boolean;
|
|
61
|
+
* ecmaVersion: NormalizedEcmaVersion;
|
|
62
|
+
* }} ExtraNoTokens
|
|
63
|
+
* @typedef {{
|
|
64
|
+
* tokens: EsprimaToken[]
|
|
65
|
+
* } & ExtraNoTokens} Extra
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
//------------------------------------------------------------------------------
|
|
69
|
+
// Private
|
|
70
|
+
//------------------------------------------------------------------------------
|
|
71
|
+
|
|
72
|
+
// Esprima Token Types
|
|
73
|
+
const Token = {
|
|
74
|
+
Boolean: "Boolean",
|
|
75
|
+
EOF: "<end>",
|
|
76
|
+
Identifier: "Identifier",
|
|
77
|
+
PrivateIdentifier: "PrivateIdentifier",
|
|
78
|
+
Keyword: "Keyword",
|
|
79
|
+
Null: "Null",
|
|
80
|
+
Numeric: "Numeric",
|
|
81
|
+
Punctuator: "Punctuator",
|
|
82
|
+
String: "String",
|
|
83
|
+
RegularExpression: "RegularExpression",
|
|
84
|
+
Template: "Template",
|
|
85
|
+
JSXIdentifier: "JSXIdentifier",
|
|
86
|
+
JSXText: "JSXText"
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Converts part of a template into an Esprima token.
|
|
91
|
+
* @param {acorn.Token[]} tokens The Acorn tokens representing the template.
|
|
92
|
+
* @param {string} code The source code.
|
|
93
|
+
* @returns {EsprimaToken} The Esprima equivalent of the template token.
|
|
94
|
+
* @private
|
|
95
|
+
*/
|
|
96
|
+
function convertTemplatePart(tokens, code) {
|
|
97
|
+
const firstToken = tokens[0],
|
|
98
|
+
lastTemplateToken =
|
|
99
|
+
/**
|
|
100
|
+
* @type {acorn.Token & {
|
|
101
|
+
* loc: acorn.SourceLocation,
|
|
102
|
+
* range: [number, number]
|
|
103
|
+
* }}
|
|
104
|
+
*/ (tokens.at(-1));
|
|
105
|
+
|
|
106
|
+
/** @type {EsprimaToken} */
|
|
107
|
+
const token = {
|
|
108
|
+
type: Token.Template,
|
|
109
|
+
value: code.slice(firstToken.start, lastTemplateToken.end)
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
if (firstToken.loc) {
|
|
113
|
+
token.loc = {
|
|
114
|
+
start: firstToken.loc.start,
|
|
115
|
+
end: lastTemplateToken.loc.end
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (firstToken.range) {
|
|
120
|
+
token.start = firstToken.range[0];
|
|
121
|
+
token.end = lastTemplateToken.range[1];
|
|
122
|
+
token.range = [token.start, token.end];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return token;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* eslint-disable jsdoc/check-types -- The API allows either */
|
|
129
|
+
/**
|
|
130
|
+
* Contains logic to translate Acorn tokens into Esprima tokens.
|
|
131
|
+
*/
|
|
132
|
+
class TokenTranslator {
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Contains logic to translate Acorn tokens into Esprima tokens.
|
|
136
|
+
* @param {EnhancedTokTypes} acornTokTypes The Acorn token types.
|
|
137
|
+
* @param {string|String} code The source code Acorn is parsing. This is necessary
|
|
138
|
+
* to correct the "value" property of some tokens.
|
|
139
|
+
*/
|
|
140
|
+
constructor(acornTokTypes, code) {
|
|
141
|
+
/* eslint-enable jsdoc/check-types -- The API allows either */
|
|
142
|
+
|
|
143
|
+
// token types
|
|
144
|
+
this._acornTokTypes = acornTokTypes;
|
|
145
|
+
|
|
146
|
+
// token buffer for templates
|
|
147
|
+
/** @type {acorn.Token[]} */
|
|
148
|
+
this._tokens = [];
|
|
149
|
+
|
|
150
|
+
// track the last curly brace
|
|
151
|
+
this._curlyBrace = null;
|
|
152
|
+
|
|
153
|
+
// the source code
|
|
154
|
+
this._code = code;
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Translates a single Esprima token to a single Acorn token. This may be
|
|
160
|
+
* inaccurate due to how templates are handled differently in Esprima and
|
|
161
|
+
* Acorn, but should be accurate for all other tokens.
|
|
162
|
+
* @param {acorn.Token} token The Acorn token to translate.
|
|
163
|
+
* @param {ExtraNoTokens} extra Espree extra object.
|
|
164
|
+
* @returns {EsprimaToken} The Esprima version of the token.
|
|
165
|
+
*/
|
|
166
|
+
translate(token, extra) {
|
|
167
|
+
|
|
168
|
+
const type = token.type,
|
|
169
|
+
tt = this._acornTokTypes,
|
|
170
|
+
|
|
171
|
+
// We use an unknown type because `acorn.Token` is a class whose
|
|
172
|
+
// `type` property we cannot override to our desired `string`;
|
|
173
|
+
// this also allows us to define a stricter `EsprimaToken` with
|
|
174
|
+
// a string-only `type` property
|
|
175
|
+
unknownTokenType = /** @type {unknown} */ (token),
|
|
176
|
+
newToken = /** @type {EsprimaToken} */ (unknownTokenType);
|
|
177
|
+
|
|
178
|
+
if (type === tt.name) {
|
|
179
|
+
newToken.type = Token.Identifier;
|
|
180
|
+
|
|
181
|
+
// TODO: See if this is an Acorn bug
|
|
182
|
+
if ("value" in token && token.value === "static") {
|
|
183
|
+
newToken.type = Token.Keyword;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (extra.ecmaVersion > 5 && ("value" in token && (token.value === "yield" || token.value === "let"))) {
|
|
187
|
+
newToken.type = Token.Keyword;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
} else if (type === tt.privateId) {
|
|
191
|
+
newToken.type = Token.PrivateIdentifier;
|
|
192
|
+
|
|
193
|
+
} else if (type === tt.semi || type === tt.comma ||
|
|
194
|
+
type === tt.parenL || type === tt.parenR ||
|
|
195
|
+
type === tt.braceL || type === tt.braceR ||
|
|
196
|
+
type === tt.dot || type === tt.bracketL ||
|
|
197
|
+
type === tt.colon || type === tt.question ||
|
|
198
|
+
type === tt.bracketR || type === tt.ellipsis ||
|
|
199
|
+
type === tt.arrow || type === tt.jsxTagStart ||
|
|
200
|
+
type === tt.incDec || type === tt.starstar ||
|
|
201
|
+
type === tt.jsxTagEnd || type === tt.prefix ||
|
|
202
|
+
type === tt.questionDot ||
|
|
203
|
+
("binop" in type && type.binop && !type.keyword) ||
|
|
204
|
+
("isAssign" in type && type.isAssign)) {
|
|
205
|
+
|
|
206
|
+
newToken.type = Token.Punctuator;
|
|
207
|
+
newToken.value = this._code.slice(token.start, token.end);
|
|
208
|
+
} else if (type === tt.jsxName) {
|
|
209
|
+
newToken.type = Token.JSXIdentifier;
|
|
210
|
+
} else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) {
|
|
211
|
+
newToken.type = Token.JSXText;
|
|
212
|
+
} else if (type.keyword) {
|
|
213
|
+
if (type.keyword === "true" || type.keyword === "false") {
|
|
214
|
+
newToken.type = Token.Boolean;
|
|
215
|
+
} else if (type.keyword === "null") {
|
|
216
|
+
newToken.type = Token.Null;
|
|
217
|
+
} else {
|
|
218
|
+
newToken.type = Token.Keyword;
|
|
219
|
+
}
|
|
220
|
+
} else if (type === tt.num) {
|
|
221
|
+
newToken.type = Token.Numeric;
|
|
222
|
+
newToken.value = this._code.slice(token.start, token.end);
|
|
223
|
+
} else if (type === tt.string) {
|
|
224
|
+
|
|
225
|
+
if (extra.jsxAttrValueToken) {
|
|
226
|
+
extra.jsxAttrValueToken = false;
|
|
227
|
+
newToken.type = Token.JSXText;
|
|
228
|
+
} else {
|
|
229
|
+
newToken.type = Token.String;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
newToken.value = this._code.slice(token.start, token.end);
|
|
233
|
+
} else if (type === tt.regexp) {
|
|
234
|
+
newToken.type = Token.RegularExpression;
|
|
235
|
+
const value = /** @type {{flags: string, pattern: string}} */ (
|
|
236
|
+
"value" in token && token.value
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
newToken.regex = {
|
|
240
|
+
flags: value.flags,
|
|
241
|
+
pattern: value.pattern
|
|
242
|
+
};
|
|
243
|
+
newToken.value = `/${value.pattern}/${value.flags}`;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return newToken;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Function to call during Acorn's onToken handler.
|
|
251
|
+
* @param {acorn.Token} token The Acorn token.
|
|
252
|
+
* @param {Extra} extra The Espree extra object.
|
|
253
|
+
* @returns {void}
|
|
254
|
+
*/
|
|
255
|
+
onToken(token, extra) {
|
|
256
|
+
|
|
257
|
+
const tt = this._acornTokTypes,
|
|
258
|
+
tokens = extra.tokens,
|
|
259
|
+
templateTokens = this._tokens;
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Flushes the buffered template tokens and resets the template
|
|
263
|
+
* tracking.
|
|
264
|
+
* @returns {void}
|
|
265
|
+
* @private
|
|
266
|
+
*/
|
|
267
|
+
const translateTemplateTokens = () => {
|
|
268
|
+
tokens.push(convertTemplatePart(this._tokens, this._code));
|
|
269
|
+
this._tokens = [];
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
if (token.type === tt.eof) {
|
|
273
|
+
|
|
274
|
+
// might be one last curlyBrace
|
|
275
|
+
if (this._curlyBrace) {
|
|
276
|
+
tokens.push(this.translate(this._curlyBrace, extra));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (token.type === tt.backQuote) {
|
|
283
|
+
|
|
284
|
+
// if there's already a curly, it's not part of the template
|
|
285
|
+
if (this._curlyBrace) {
|
|
286
|
+
tokens.push(this.translate(this._curlyBrace, extra));
|
|
287
|
+
this._curlyBrace = null;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
templateTokens.push(token);
|
|
291
|
+
|
|
292
|
+
// it's the end
|
|
293
|
+
if (templateTokens.length > 1) {
|
|
294
|
+
translateTemplateTokens();
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (token.type === tt.dollarBraceL) {
|
|
300
|
+
templateTokens.push(token);
|
|
301
|
+
translateTemplateTokens();
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
if (token.type === tt.braceR) {
|
|
305
|
+
|
|
306
|
+
// if there's already a curly, it's not part of the template
|
|
307
|
+
if (this._curlyBrace) {
|
|
308
|
+
tokens.push(this.translate(this._curlyBrace, extra));
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// store new curly for later
|
|
312
|
+
this._curlyBrace = token;
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
if (token.type === tt.template || token.type === tt.invalidTemplate) {
|
|
316
|
+
if (this._curlyBrace) {
|
|
317
|
+
templateTokens.push(this._curlyBrace);
|
|
318
|
+
this._curlyBrace = null;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
templateTokens.push(token);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (this._curlyBrace) {
|
|
326
|
+
tokens.push(this.translate(this._curlyBrace, extra));
|
|
327
|
+
this._curlyBrace = null;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
tokens.push(this.translate(token, extra));
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* @fileoverview A collection of methods for processing Espree's options.
|
|
336
|
+
* @author Kai Cataldo
|
|
337
|
+
*/
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* @import { EcmaVersion, Options } from "../espree.js";
|
|
341
|
+
*/
|
|
342
|
+
|
|
343
|
+
//------------------------------------------------------------------------------
|
|
344
|
+
// Helpers
|
|
345
|
+
//------------------------------------------------------------------------------
|
|
346
|
+
|
|
347
|
+
const SUPPORTED_VERSIONS = /** @type {const} */ ([
|
|
348
|
+
3,
|
|
349
|
+
5,
|
|
350
|
+
6, // 2015
|
|
351
|
+
7, // 2016
|
|
352
|
+
8, // 2017
|
|
353
|
+
9, // 2018
|
|
354
|
+
10, // 2019
|
|
355
|
+
11, // 2020
|
|
356
|
+
12, // 2021
|
|
357
|
+
13, // 2022
|
|
358
|
+
14, // 2023
|
|
359
|
+
15, // 2024
|
|
360
|
+
16, // 2025
|
|
361
|
+
17 // 2026
|
|
362
|
+
]);
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* @typedef {typeof SUPPORTED_VERSIONS[number]} NormalizedEcmaVersion
|
|
366
|
+
*/
|
|
367
|
+
|
|
368
|
+
const LATEST_ECMA_VERSION =
|
|
369
|
+
/* eslint-disable jsdoc/valid-types -- Bug */
|
|
370
|
+
/** @type {typeof SUPPORTED_VERSIONS extends readonly [...unknown[], infer L] ? L : never} */ (
|
|
371
|
+
SUPPORTED_VERSIONS.at(-1)
|
|
372
|
+
/* eslint-enable jsdoc/valid-types -- Bug */
|
|
373
|
+
);
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Get the latest ECMAScript version supported by Espree.
|
|
377
|
+
* @returns {typeof LATEST_ECMA_VERSION} The latest ECMAScript version.
|
|
378
|
+
*/
|
|
379
|
+
function getLatestEcmaVersion() {
|
|
380
|
+
return LATEST_ECMA_VERSION;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Get the list of ECMAScript versions supported by Espree.
|
|
385
|
+
* @returns {[...typeof SUPPORTED_VERSIONS]} An array containing the supported ECMAScript versions.
|
|
386
|
+
*/
|
|
387
|
+
function getSupportedEcmaVersions() {
|
|
388
|
+
return [...SUPPORTED_VERSIONS];
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Normalize ECMAScript version from the initial config
|
|
393
|
+
* @param {EcmaVersion} ecmaVersion ECMAScript version from the initial config
|
|
394
|
+
* @throws {Error} throws an error if the ecmaVersion is invalid.
|
|
395
|
+
* @returns {NormalizedEcmaVersion} normalized ECMAScript version
|
|
396
|
+
*/
|
|
397
|
+
function normalizeEcmaVersion(ecmaVersion = 5) {
|
|
398
|
+
|
|
399
|
+
let version = ecmaVersion === "latest" ? getLatestEcmaVersion() : ecmaVersion;
|
|
400
|
+
|
|
401
|
+
if (typeof version !== "number") {
|
|
402
|
+
throw new Error(`ecmaVersion must be a number or "latest". Received value of type ${typeof ecmaVersion} instead.`);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// Calculate ECMAScript edition number from official year version starting with
|
|
406
|
+
// ES2015, which corresponds with ES6 (or a difference of 2009).
|
|
407
|
+
if (version >= 2015) {
|
|
408
|
+
version -= 2009;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
if (!SUPPORTED_VERSIONS.includes(
|
|
412
|
+
|
|
413
|
+
/** @type {NormalizedEcmaVersion} */
|
|
414
|
+
(version)
|
|
415
|
+
)) {
|
|
416
|
+
throw new Error("Invalid ecmaVersion.");
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
return /** @type {NormalizedEcmaVersion} */ (version);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Normalize sourceType from the initial config
|
|
424
|
+
* @param {string} sourceType to normalize
|
|
425
|
+
* @throws {Error} throw an error if sourceType is invalid
|
|
426
|
+
* @returns {"script"|"module"} normalized sourceType
|
|
427
|
+
*/
|
|
428
|
+
function normalizeSourceType(sourceType = "script") {
|
|
429
|
+
if (sourceType === "script" || sourceType === "module") {
|
|
430
|
+
return sourceType;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (sourceType === "commonjs") {
|
|
434
|
+
return "script";
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
throw new Error("Invalid sourceType.");
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* @typedef {{
|
|
442
|
+
* ecmaVersion: NormalizedEcmaVersion,
|
|
443
|
+
* sourceType: "script"|"module",
|
|
444
|
+
* range?: boolean,
|
|
445
|
+
* loc?: boolean,
|
|
446
|
+
* allowReserved: boolean | "never",
|
|
447
|
+
* ecmaFeatures?: {
|
|
448
|
+
* jsx?: boolean,
|
|
449
|
+
* globalReturn?: boolean,
|
|
450
|
+
* impliedStrict?: boolean
|
|
451
|
+
* },
|
|
452
|
+
* ranges: boolean,
|
|
453
|
+
* locations: boolean,
|
|
454
|
+
* allowReturnOutsideFunction: boolean,
|
|
455
|
+
* tokens?: boolean,
|
|
456
|
+
* comment?: boolean
|
|
457
|
+
* }} NormalizedParserOptions
|
|
458
|
+
*/
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Normalize parserOptions
|
|
462
|
+
* @param {Options} options the parser options to normalize
|
|
463
|
+
* @throws {Error} throw an error if found invalid option.
|
|
464
|
+
* @returns {NormalizedParserOptions} normalized options
|
|
465
|
+
*/
|
|
466
|
+
function normalizeOptions(options) {
|
|
467
|
+
const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion);
|
|
468
|
+
const sourceType = normalizeSourceType(options.sourceType);
|
|
469
|
+
const ranges = options.range === true;
|
|
470
|
+
const locations = options.loc === true;
|
|
471
|
+
|
|
472
|
+
if (ecmaVersion !== 3 && options.allowReserved) {
|
|
473
|
+
|
|
474
|
+
// a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed
|
|
475
|
+
throw new Error("`allowReserved` is only supported when ecmaVersion is 3");
|
|
476
|
+
}
|
|
477
|
+
if (typeof options.allowReserved !== "undefined" && typeof options.allowReserved !== "boolean") {
|
|
478
|
+
throw new Error("`allowReserved`, when present, must be `true` or `false`");
|
|
479
|
+
}
|
|
480
|
+
const allowReserved = ecmaVersion === 3 ? (options.allowReserved || "never") : false;
|
|
481
|
+
const ecmaFeatures = options.ecmaFeatures || {};
|
|
482
|
+
const allowReturnOutsideFunction = options.sourceType === "commonjs" ||
|
|
483
|
+
Boolean(ecmaFeatures.globalReturn);
|
|
484
|
+
|
|
485
|
+
if (sourceType === "module" && ecmaVersion < 6) {
|
|
486
|
+
throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options.");
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return Object.assign({}, options, {
|
|
490
|
+
ecmaVersion,
|
|
491
|
+
sourceType,
|
|
492
|
+
ranges,
|
|
493
|
+
locations,
|
|
494
|
+
allowReserved,
|
|
495
|
+
allowReturnOutsideFunction
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/* eslint no-param-reassign: 0 -- stylistic choice */
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* @import {
|
|
503
|
+
* CommentType,
|
|
504
|
+
* EspreeParserCtor,
|
|
505
|
+
* EsprimaNode,
|
|
506
|
+
* AcornJsxParserCtorEnhanced,
|
|
507
|
+
* TokTypes
|
|
508
|
+
* } from "./types.js";
|
|
509
|
+
* @import {
|
|
510
|
+
* Options,
|
|
511
|
+
* EspreeToken as EsprimaToken,
|
|
512
|
+
* EspreeTokens as EsprimaTokens,
|
|
513
|
+
* EspreeComment as EsprimaComment
|
|
514
|
+
* } from "../espree.js";
|
|
515
|
+
* @import { NormalizedEcmaVersion } from "./options.js";
|
|
516
|
+
* @import * as acorn from "acorn";
|
|
517
|
+
*/
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* @typedef {{
|
|
521
|
+
* originalSourceType: "script" | "module" | "commonjs" | undefined
|
|
522
|
+
* tokens: EsprimaToken[] | null,
|
|
523
|
+
* comments: EsprimaComment[] | null,
|
|
524
|
+
* impliedStrict: boolean,
|
|
525
|
+
* ecmaVersion: NormalizedEcmaVersion,
|
|
526
|
+
* jsxAttrValueToken: boolean,
|
|
527
|
+
* lastToken: acorn.Token | null,
|
|
528
|
+
* templateElements: acorn.TemplateElement[]
|
|
529
|
+
* }} State
|
|
530
|
+
*/
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* @typedef {{
|
|
534
|
+
* sourceType?: "script"|"module"|"commonjs";
|
|
535
|
+
* comments?: EsprimaComment[];
|
|
536
|
+
* tokens?: EsprimaToken[];
|
|
537
|
+
* body: acorn.Node[];
|
|
538
|
+
* } & acorn.Program} EsprimaProgramNode
|
|
539
|
+
*/
|
|
540
|
+
|
|
541
|
+
// ----------------------------------------------------------------------------
|
|
542
|
+
// Types exported from file
|
|
543
|
+
// ----------------------------------------------------------------------------
|
|
544
|
+
/**
|
|
545
|
+
* @typedef {{
|
|
546
|
+
* index?: number;
|
|
547
|
+
* lineNumber?: number;
|
|
548
|
+
* column?: number;
|
|
549
|
+
* } & SyntaxError} EnhancedSyntaxError
|
|
550
|
+
*/
|
|
551
|
+
|
|
552
|
+
// We add `jsxAttrValueToken` ourselves.
|
|
553
|
+
/**
|
|
554
|
+
* @typedef {{
|
|
555
|
+
* jsxAttrValueToken?: acorn.TokenType;
|
|
556
|
+
* } & TokTypes} EnhancedTokTypes
|
|
557
|
+
*/
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
const STATE = Symbol("espree's internal state");
|
|
561
|
+
const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode");
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Converts an Acorn comment to a Esprima comment.
|
|
566
|
+
* @param {boolean} block True if it's a block comment, false if not.
|
|
567
|
+
* @param {string} text The text of the comment.
|
|
568
|
+
* @param {number} start The index at which the comment starts.
|
|
569
|
+
* @param {number} end The index at which the comment ends.
|
|
570
|
+
* @param {acorn.Position | undefined} startLoc The location at which the comment starts.
|
|
571
|
+
* @param {acorn.Position | undefined} endLoc The location at which the comment ends.
|
|
572
|
+
* @param {string} code The source code being parsed.
|
|
573
|
+
* @returns {EsprimaComment} The comment object.
|
|
574
|
+
* @private
|
|
575
|
+
*/
|
|
576
|
+
function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc, code) {
|
|
577
|
+
|
|
578
|
+
/** @type {CommentType} */
|
|
579
|
+
let type;
|
|
580
|
+
|
|
581
|
+
if (block) {
|
|
582
|
+
type = "Block";
|
|
583
|
+
} else if (code.slice(start, start + 2) === "#!") {
|
|
584
|
+
type = "Hashbang";
|
|
585
|
+
} else {
|
|
586
|
+
type = "Line";
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* @type {{
|
|
591
|
+
* type: CommentType,
|
|
592
|
+
* value: string,
|
|
593
|
+
* start?: number,
|
|
594
|
+
* end?: number,
|
|
595
|
+
* range?: [number, number],
|
|
596
|
+
* loc?: {
|
|
597
|
+
* start: acorn.Position | undefined,
|
|
598
|
+
* end: acorn.Position | undefined
|
|
599
|
+
* }
|
|
600
|
+
* }}
|
|
601
|
+
*/
|
|
602
|
+
const comment = {
|
|
603
|
+
type,
|
|
604
|
+
value: text
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
if (typeof start === "number") {
|
|
608
|
+
comment.start = start;
|
|
609
|
+
comment.end = end;
|
|
610
|
+
comment.range = [start, end];
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
if (typeof startLoc === "object") {
|
|
614
|
+
comment.loc = {
|
|
615
|
+
start: startLoc,
|
|
616
|
+
end: endLoc
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
return comment;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
// eslint-disable-next-line arrow-body-style -- For TS
|
|
624
|
+
var espree = () => {
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Returns the Espree parser.
|
|
628
|
+
* @param {AcornJsxParserCtorEnhanced} Parser The Acorn parser. The `acorn` property is missing from acorn's
|
|
629
|
+
* TypeScript but is present statically on the class.
|
|
630
|
+
* @returns {EspreeParserCtor} The Espree Parser constructor.
|
|
631
|
+
*/
|
|
632
|
+
return Parser => {
|
|
633
|
+
const tokTypes = /** @type {EnhancedTokTypes} */ (
|
|
634
|
+
Object.assign({}, Parser.acorn.tokTypes)
|
|
635
|
+
);
|
|
636
|
+
|
|
637
|
+
if (Parser.acornJsx) {
|
|
638
|
+
Object.assign(tokTypes, Parser.acornJsx.tokTypes);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
return class Espree extends Parser {
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* @param {Options | null | undefined} opts The parser options
|
|
645
|
+
* @param {string | object} code The code which will be converted to a string.
|
|
646
|
+
*/
|
|
647
|
+
constructor(opts, code) {
|
|
648
|
+
if (typeof opts !== "object" || opts === null) {
|
|
649
|
+
opts = {};
|
|
650
|
+
}
|
|
651
|
+
if (typeof code !== "string" && !(code instanceof String)) {
|
|
652
|
+
code = String(code);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
// save original source type in case of commonjs
|
|
656
|
+
const originalSourceType = opts.sourceType;
|
|
657
|
+
const options = normalizeOptions(opts);
|
|
658
|
+
const ecmaFeatures = options.ecmaFeatures || {};
|
|
659
|
+
const tokenTranslator =
|
|
660
|
+
options.tokens === true
|
|
661
|
+
? new TokenTranslator(
|
|
662
|
+
tokTypes,
|
|
663
|
+
|
|
664
|
+
// @ts-expect-error Appears to be a TS bug since the type is indeed string|String
|
|
665
|
+
code
|
|
666
|
+
)
|
|
667
|
+
: null;
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Data that is unique to Espree and is not represented internally
|
|
671
|
+
* in Acorn.
|
|
672
|
+
*
|
|
673
|
+
* For ES2023 hashbangs, Espree will call `onComment()` during the
|
|
674
|
+
* constructor, so we must define state before having access to
|
|
675
|
+
* `this`.
|
|
676
|
+
* @type {State}
|
|
677
|
+
*/
|
|
678
|
+
const state = {
|
|
679
|
+
originalSourceType: originalSourceType || options.sourceType,
|
|
680
|
+
tokens: tokenTranslator ? [] : null,
|
|
681
|
+
comments: options.comment === true ? [] : null,
|
|
682
|
+
impliedStrict: ecmaFeatures.impliedStrict === true && options.ecmaVersion >= 5,
|
|
683
|
+
ecmaVersion: options.ecmaVersion,
|
|
684
|
+
jsxAttrValueToken: false,
|
|
685
|
+
lastToken: null,
|
|
686
|
+
templateElements: []
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
// Initialize acorn parser.
|
|
690
|
+
super({
|
|
691
|
+
|
|
692
|
+
// do not use spread, because we don't want to pass any unknown options to acorn
|
|
693
|
+
ecmaVersion: options.ecmaVersion,
|
|
694
|
+
sourceType: options.sourceType,
|
|
695
|
+
ranges: options.ranges,
|
|
696
|
+
locations: options.locations,
|
|
697
|
+
allowReserved: options.allowReserved,
|
|
698
|
+
|
|
699
|
+
// Truthy value is true for backward compatibility.
|
|
700
|
+
allowReturnOutsideFunction: options.allowReturnOutsideFunction,
|
|
701
|
+
|
|
702
|
+
// Collect tokens
|
|
703
|
+
onToken(token) {
|
|
704
|
+
if (tokenTranslator) {
|
|
705
|
+
|
|
706
|
+
// Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state.
|
|
707
|
+
tokenTranslator.onToken(
|
|
708
|
+
token,
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* @type {Omit<State, "tokens"> & {
|
|
712
|
+
* tokens: EsprimaToken[]
|
|
713
|
+
* }}
|
|
714
|
+
*/
|
|
715
|
+
(state)
|
|
716
|
+
);
|
|
717
|
+
}
|
|
718
|
+
if (token.type !== tokTypes.eof) {
|
|
719
|
+
state.lastToken = token;
|
|
720
|
+
}
|
|
721
|
+
},
|
|
722
|
+
|
|
723
|
+
// Collect comments
|
|
724
|
+
onComment(block, text, start, end, startLoc, endLoc) {
|
|
725
|
+
if (state.comments) {
|
|
726
|
+
const comment = convertAcornCommentToEsprimaComment(
|
|
727
|
+
block,
|
|
728
|
+
text,
|
|
729
|
+
start,
|
|
730
|
+
end,
|
|
731
|
+
startLoc,
|
|
732
|
+
endLoc,
|
|
733
|
+
|
|
734
|
+
// @ts-expect-error Appears to be a TS bug
|
|
735
|
+
// since the type is indeed string|String
|
|
736
|
+
code
|
|
737
|
+
);
|
|
738
|
+
|
|
739
|
+
state.comments.push(comment);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// @ts-expect-error Appears to be a TS bug
|
|
744
|
+
// since the type is indeed string|String
|
|
745
|
+
}, code);
|
|
746
|
+
|
|
747
|
+
/*
|
|
748
|
+
* We put all of this data into a symbol property as a way to avoid
|
|
749
|
+
* potential naming conflicts with future versions of Acorn.
|
|
750
|
+
*/
|
|
751
|
+
this[STATE] = state;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* Returns Espree tokens.
|
|
756
|
+
* @returns {EsprimaTokens} The Esprima-compatible tokens
|
|
757
|
+
*/
|
|
758
|
+
tokenize() {
|
|
759
|
+
do {
|
|
760
|
+
this.next();
|
|
761
|
+
} while (this.type !== tokTypes.eof);
|
|
762
|
+
|
|
763
|
+
// Consume the final eof token
|
|
764
|
+
this.next();
|
|
765
|
+
|
|
766
|
+
const extra = this[STATE];
|
|
767
|
+
const tokens = /** @type {EsprimaTokens} */ (extra.tokens);
|
|
768
|
+
|
|
769
|
+
if (extra.comments) {
|
|
770
|
+
tokens.comments = extra.comments;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
return tokens;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Calls parent.
|
|
778
|
+
* @param {acorn.Node} node The node
|
|
779
|
+
* @param {string} type The type
|
|
780
|
+
* @returns {acorn.Node} The altered Node
|
|
781
|
+
*/
|
|
782
|
+
finishNode(node, type) {
|
|
783
|
+
const result = super.finishNode(node, type);
|
|
784
|
+
|
|
785
|
+
return this[ESPRIMA_FINISH_NODE](result);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Calls parent.
|
|
790
|
+
* @param {acorn.Node} node The node
|
|
791
|
+
* @param {string} type The type
|
|
792
|
+
* @param {number} pos The position
|
|
793
|
+
* @param {acorn.Position} loc The location
|
|
794
|
+
* @returns {acorn.Node} The altered Node
|
|
795
|
+
*/
|
|
796
|
+
finishNodeAt(node, type, pos, loc) {
|
|
797
|
+
const result = super.finishNodeAt(node, type, pos, loc);
|
|
798
|
+
|
|
799
|
+
return this[ESPRIMA_FINISH_NODE](result);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Parses.
|
|
804
|
+
* @returns {EsprimaProgramNode} The program Node
|
|
805
|
+
*/
|
|
806
|
+
parse() {
|
|
807
|
+
const extra = this[STATE];
|
|
808
|
+
const prog = super.parse();
|
|
809
|
+
|
|
810
|
+
const program = /** @type {EsprimaProgramNode} */ (prog);
|
|
811
|
+
|
|
812
|
+
// @ts-expect-error TS bug? We've already converted to `EsprimaProgramNode`
|
|
813
|
+
program.sourceType = extra.originalSourceType;
|
|
814
|
+
|
|
815
|
+
if (extra.comments) {
|
|
816
|
+
program.comments = extra.comments;
|
|
817
|
+
}
|
|
818
|
+
if (extra.tokens) {
|
|
819
|
+
program.tokens = extra.tokens;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
/*
|
|
823
|
+
* https://github.com/eslint/espree/issues/349
|
|
824
|
+
* Ensure that template elements have correct range information.
|
|
825
|
+
* This is one location where Acorn produces a different value
|
|
826
|
+
* for its start and end properties vs. the values present in the
|
|
827
|
+
* range property. In order to avoid confusion, we set the start
|
|
828
|
+
* and end properties to the values that are present in range.
|
|
829
|
+
* This is done here, instead of in finishNode(), because Acorn
|
|
830
|
+
* uses the values of start and end internally while parsing, making
|
|
831
|
+
* it dangerous to change those values while parsing is ongoing.
|
|
832
|
+
* By waiting until the end of parsing, we can safely change these
|
|
833
|
+
* values without affect any other part of the process.
|
|
834
|
+
*/
|
|
835
|
+
this[STATE].templateElements.forEach(templateElement => {
|
|
836
|
+
const startOffset = -1;
|
|
837
|
+
const endOffset = templateElement.tail ? 1 : 2;
|
|
838
|
+
|
|
839
|
+
templateElement.start += startOffset;
|
|
840
|
+
templateElement.end += endOffset;
|
|
841
|
+
|
|
842
|
+
if (templateElement.range) {
|
|
843
|
+
templateElement.range[0] += startOffset;
|
|
844
|
+
templateElement.range[1] += endOffset;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
if (templateElement.loc) {
|
|
848
|
+
templateElement.loc.start.column += startOffset;
|
|
849
|
+
templateElement.loc.end.column += endOffset;
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
|
|
853
|
+
return program;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Parses top level.
|
|
858
|
+
* @param {acorn.Node} node AST Node
|
|
859
|
+
* @returns {acorn.Node} The changed node
|
|
860
|
+
*/
|
|
861
|
+
parseTopLevel(node) {
|
|
862
|
+
if (this[STATE].impliedStrict) {
|
|
863
|
+
this.strict = true;
|
|
864
|
+
}
|
|
865
|
+
return super.parseTopLevel(node);
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* Overwrites the default raise method to throw Esprima-style errors.
|
|
870
|
+
* @param {number} pos The position of the error.
|
|
871
|
+
* @param {string} message The error message.
|
|
872
|
+
* @throws {EnhancedSyntaxError} A syntax error.
|
|
873
|
+
* @returns {void}
|
|
874
|
+
*/
|
|
875
|
+
raise(pos, message) {
|
|
876
|
+
const loc = Parser.acorn.getLineInfo(this.input, pos);
|
|
877
|
+
const err = /** @type {EnhancedSyntaxError} */ (
|
|
878
|
+
new SyntaxError(message)
|
|
879
|
+
);
|
|
880
|
+
|
|
881
|
+
err.index = pos;
|
|
882
|
+
err.lineNumber = loc.line;
|
|
883
|
+
err.column = loc.column + 1; // acorn uses 0-based columns
|
|
884
|
+
throw err;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* Overwrites the default raise method to throw Esprima-style errors.
|
|
889
|
+
* @param {number} pos The position of the error.
|
|
890
|
+
* @param {string} message The error message.
|
|
891
|
+
* @throws {SyntaxError} A syntax error.
|
|
892
|
+
* @returns {void}
|
|
893
|
+
*/
|
|
894
|
+
raiseRecoverable(pos, message) {
|
|
895
|
+
this.raise(pos, message);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* Overwrites the default unexpected method to throw Esprima-style errors.
|
|
900
|
+
* @param {number} pos The position of the error.
|
|
901
|
+
* @throws {SyntaxError} A syntax error.
|
|
902
|
+
* @returns {void}
|
|
903
|
+
*/
|
|
904
|
+
unexpected(pos) {
|
|
905
|
+
let message = "Unexpected token";
|
|
906
|
+
|
|
907
|
+
if (pos !== null && pos !== void 0) {
|
|
908
|
+
this.pos = pos;
|
|
909
|
+
|
|
910
|
+
if (this.options.locations) {
|
|
911
|
+
while (this.pos < this.lineStart) {
|
|
912
|
+
this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1;
|
|
913
|
+
--this.curLine;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
this.nextToken();
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
if (this.end > this.start) {
|
|
921
|
+
message += ` ${this.input.slice(this.start, this.end)}`;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
this.raise(this.start, message);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* Esprima-FB represents JSX strings as tokens called "JSXText", but Acorn-JSX
|
|
929
|
+
* uses regular tt.string without any distinction between this and regular JS
|
|
930
|
+
* strings. As such, we intercept an attempt to read a JSX string and set a flag
|
|
931
|
+
* on extra so that when tokens are converted, the next token will be switched
|
|
932
|
+
* to JSXText via onToken.
|
|
933
|
+
* @param {number} quote A character code
|
|
934
|
+
* @returns {void}
|
|
935
|
+
*/
|
|
936
|
+
jsx_readString(quote) { // eslint-disable-line camelcase -- required by API
|
|
937
|
+
const result = super.jsx_readString(quote);
|
|
938
|
+
|
|
939
|
+
if (this.type === tokTypes.string) {
|
|
940
|
+
this[STATE].jsxAttrValueToken = true;
|
|
941
|
+
}
|
|
942
|
+
return result;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Performs last-minute Esprima-specific compatibility checks and fixes.
|
|
947
|
+
* @param {acorn.Node} result The node to check.
|
|
948
|
+
* @returns {EsprimaNode} The finished node.
|
|
949
|
+
*/
|
|
950
|
+
[ESPRIMA_FINISH_NODE](result) {
|
|
951
|
+
|
|
952
|
+
// Acorn doesn't count the opening and closing backticks as part of templates
|
|
953
|
+
// so we have to adjust ranges/locations appropriately.
|
|
954
|
+
if (result.type === "TemplateElement") {
|
|
955
|
+
|
|
956
|
+
// save template element references to fix start/end later
|
|
957
|
+
this[STATE].templateElements.push(
|
|
958
|
+
|
|
959
|
+
/** @type {acorn.TemplateElement} */
|
|
960
|
+
(result)
|
|
961
|
+
);
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
if (result.type.includes("Function") && (!("generator" in result))) {
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* @type {acorn.FunctionDeclaration|acorn.FunctionExpression|
|
|
968
|
+
* acorn.ArrowFunctionExpression}
|
|
969
|
+
*/
|
|
970
|
+
(result).generator = false;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
return result;
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
};
|
|
977
|
+
};
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* @fileoverview Main Espree file that converts Acorn into Esprima output.
|
|
981
|
+
*
|
|
982
|
+
* This file contains code from the following MIT-licensed projects:
|
|
983
|
+
* 1. Acorn
|
|
984
|
+
* 2. Babylon
|
|
985
|
+
* 3. Babel-ESLint
|
|
986
|
+
*
|
|
987
|
+
* This file also contains code from Esprima, which is BSD licensed.
|
|
988
|
+
*
|
|
989
|
+
* Acorn is Copyright 2012-2015 Acorn Contributors (https://github.com/marijnh/acorn/blob/master/AUTHORS)
|
|
990
|
+
* Babylon is Copyright 2014-2015 various contributors (https://github.com/babel/babel/blob/master/packages/babylon/AUTHORS)
|
|
991
|
+
* Babel-ESLint is Copyright 2014-2015 Sebastian McKenzie <sebmck@gmail.com>
|
|
992
|
+
*
|
|
993
|
+
* Redistribution and use in source and binary forms, with or without
|
|
994
|
+
* modification, are permitted provided that the following conditions are met:
|
|
995
|
+
*
|
|
996
|
+
* * Redistributions of source code must retain the above copyright
|
|
997
|
+
* notice, this list of conditions and the following disclaimer.
|
|
998
|
+
* * Redistributions in binary form must reproduce the above copyright
|
|
999
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
1000
|
+
* documentation and/or other materials provided with the distribution.
|
|
1001
|
+
*
|
|
1002
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
1003
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
1004
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
1005
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
1006
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
1007
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
1008
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
1009
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
1010
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
1011
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1012
|
+
*
|
|
1013
|
+
* Esprima is Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.
|
|
1014
|
+
*
|
|
1015
|
+
* Redistribution and use in source and binary forms, with or without
|
|
1016
|
+
* modification, are permitted provided that the following conditions are met:
|
|
1017
|
+
*
|
|
1018
|
+
* * Redistributions of source code must retain the above copyright
|
|
1019
|
+
* notice, this list of conditions and the following disclaimer.
|
|
1020
|
+
* * Redistributions in binary form must reproduce the above copyright
|
|
1021
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
1022
|
+
* documentation and/or other materials provided with the distribution.
|
|
1023
|
+
*
|
|
1024
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
1025
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
1026
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
1027
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
1028
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
1029
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
1030
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
1031
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
1032
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
1033
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1034
|
+
*/
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* @import { EspreeParserCtor, EspreeParserJsxCtor } from "./lib/types.js";
|
|
1038
|
+
*/
|
|
1039
|
+
|
|
1040
|
+
// ----------------------------------------------------------------------------
|
|
1041
|
+
// Types exported from file
|
|
1042
|
+
// ----------------------------------------------------------------------------
|
|
1043
|
+
/**
|
|
1044
|
+
* @typedef {3|5|6|7|8|9|10|11|12|13|14|15|16|17|2015|2016|2017|2018|2019|2020|2021|2022|2023|2024|2025|2026|'latest'} EcmaVersion
|
|
1045
|
+
*/
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* @typedef {{
|
|
1049
|
+
* type: string;
|
|
1050
|
+
* value: any;
|
|
1051
|
+
* start?: number;
|
|
1052
|
+
* end?: number;
|
|
1053
|
+
* loc?: acorn.SourceLocation;
|
|
1054
|
+
* range?: [number, number];
|
|
1055
|
+
* regex?: {flags: string, pattern: string};
|
|
1056
|
+
* }} EspreeToken
|
|
1057
|
+
*/
|
|
1058
|
+
|
|
1059
|
+
/**
|
|
1060
|
+
* @typedef {{
|
|
1061
|
+
* type: "Block" | "Hashbang" | "Line",
|
|
1062
|
+
* value: string,
|
|
1063
|
+
* range?: [number, number],
|
|
1064
|
+
* start?: number,
|
|
1065
|
+
* end?: number,
|
|
1066
|
+
* loc?: {
|
|
1067
|
+
* start: acorn.Position | undefined,
|
|
1068
|
+
* end: acorn.Position | undefined
|
|
1069
|
+
* }
|
|
1070
|
+
* }} EspreeComment
|
|
1071
|
+
*/
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* @typedef {{
|
|
1075
|
+
* comments?: EspreeComment[]
|
|
1076
|
+
* } & EspreeToken[]} EspreeTokens
|
|
1077
|
+
*/
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* `allowReserved` is as in `acorn.Options`
|
|
1081
|
+
*
|
|
1082
|
+
* `ecmaVersion` currently as in `acorn.Options` though optional
|
|
1083
|
+
*
|
|
1084
|
+
* `sourceType` as in `acorn.Options` but also allows `commonjs`
|
|
1085
|
+
*
|
|
1086
|
+
* `ecmaFeatures`, `range`, `loc`, `tokens` are not in `acorn.Options`
|
|
1087
|
+
*
|
|
1088
|
+
* `comment` is not in `acorn.Options` and doesn't err without it, but is used
|
|
1089
|
+
*/
|
|
1090
|
+
/**
|
|
1091
|
+
* @typedef {{
|
|
1092
|
+
* allowReserved?: boolean,
|
|
1093
|
+
* ecmaVersion?: EcmaVersion,
|
|
1094
|
+
* sourceType?: "script"|"module"|"commonjs",
|
|
1095
|
+
* ecmaFeatures?: {
|
|
1096
|
+
* jsx?: boolean,
|
|
1097
|
+
* globalReturn?: boolean,
|
|
1098
|
+
* impliedStrict?: boolean
|
|
1099
|
+
* },
|
|
1100
|
+
* range?: boolean,
|
|
1101
|
+
* loc?: boolean,
|
|
1102
|
+
* tokens?: boolean,
|
|
1103
|
+
* comment?: boolean,
|
|
1104
|
+
* }} Options
|
|
1105
|
+
*/
|
|
1106
|
+
|
|
1107
|
+
// To initialize lazily.
|
|
1108
|
+
const parsers = {
|
|
1109
|
+
|
|
1110
|
+
/** @type {EspreeParserCtor|null} */
|
|
1111
|
+
_regular: null,
|
|
1112
|
+
|
|
1113
|
+
/** @type {EspreeParserJsxCtor|null} */
|
|
1114
|
+
_jsx: null,
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* Returns regular Parser
|
|
1118
|
+
* @returns {EspreeParserCtor} Regular Acorn parser
|
|
1119
|
+
*/
|
|
1120
|
+
get regular() {
|
|
1121
|
+
if (this._regular === null) {
|
|
1122
|
+
const espreeParserFactory = /** @type {unknown} */ (espree());
|
|
1123
|
+
|
|
1124
|
+
this._regular = /** @type {EspreeParserCtor} */ (
|
|
1125
|
+
// Without conversion, types are incompatible, as
|
|
1126
|
+
// acorn's has a protected constructor
|
|
1127
|
+
/** @type {unknown} */
|
|
1128
|
+
(acorn__namespace.Parser.extend(
|
|
1129
|
+
/**
|
|
1130
|
+
* @type {(
|
|
1131
|
+
* BaseParser: typeof acorn.Parser
|
|
1132
|
+
* ) => typeof acorn.Parser}
|
|
1133
|
+
*/ (espreeParserFactory)
|
|
1134
|
+
))
|
|
1135
|
+
);
|
|
1136
|
+
}
|
|
1137
|
+
return this._regular;
|
|
1138
|
+
},
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Returns JSX Parser
|
|
1142
|
+
* @returns {EspreeParserJsxCtor} JSX Acorn parser
|
|
1143
|
+
*/
|
|
1144
|
+
get jsx() {
|
|
1145
|
+
if (this._jsx === null) {
|
|
1146
|
+
const espreeParserFactory = /** @type {unknown} */ (espree());
|
|
1147
|
+
const jsxFactory = jsx__default["default"]();
|
|
1148
|
+
|
|
1149
|
+
this._jsx = /** @type {EspreeParserJsxCtor} */ (
|
|
1150
|
+
// Without conversion, types are incompatible, as
|
|
1151
|
+
// acorn's has a protected constructor
|
|
1152
|
+
/** @type {unknown} */
|
|
1153
|
+
(acorn__namespace.Parser.extend(
|
|
1154
|
+
jsxFactory,
|
|
1155
|
+
|
|
1156
|
+
/** @type {(BaseParser: typeof acorn.Parser) => typeof acorn.Parser} */
|
|
1157
|
+
(espreeParserFactory)
|
|
1158
|
+
))
|
|
1159
|
+
);
|
|
1160
|
+
}
|
|
1161
|
+
return this._jsx;
|
|
1162
|
+
},
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* Gets the parser object based on the supplied options.
|
|
1166
|
+
* @param {Options} [options] The parser options.
|
|
1167
|
+
* @returns {EspreeParserJsxCtor|EspreeParserCtor} Regular or JSX Acorn parser
|
|
1168
|
+
*/
|
|
1169
|
+
get(options) {
|
|
1170
|
+
const useJsx = Boolean(
|
|
1171
|
+
options &&
|
|
1172
|
+
options.ecmaFeatures &&
|
|
1173
|
+
options.ecmaFeatures.jsx
|
|
1174
|
+
);
|
|
1175
|
+
|
|
1176
|
+
return useJsx ? this.jsx : this.regular;
|
|
1177
|
+
}
|
|
1178
|
+
};
|
|
1179
|
+
|
|
1180
|
+
//------------------------------------------------------------------------------
|
|
1181
|
+
// Tokenizer
|
|
1182
|
+
//------------------------------------------------------------------------------
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* Tokenizes the given code.
|
|
1186
|
+
* @param {string} code The code to tokenize.
|
|
1187
|
+
* @param {Options} [options] Options defining how to tokenize.
|
|
1188
|
+
* @returns {EspreeTokens} An array of tokens.
|
|
1189
|
+
* @throws {EnhancedSyntaxError} If the input code is invalid.
|
|
1190
|
+
* @private
|
|
1191
|
+
*/
|
|
1192
|
+
function tokenize(code, options) {
|
|
1193
|
+
const Parser = parsers.get(options);
|
|
1194
|
+
|
|
1195
|
+
// Ensure to collect tokens.
|
|
1196
|
+
if (!options || options.tokens !== true) {
|
|
1197
|
+
options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign -- stylistic choice
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
return /** @type {EspreeTokens} */ (new Parser(options, code).tokenize());
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
//------------------------------------------------------------------------------
|
|
1204
|
+
// Parser
|
|
1205
|
+
//------------------------------------------------------------------------------
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* Parses the given code.
|
|
1209
|
+
* @param {string} code The code to tokenize.
|
|
1210
|
+
* @param {Options} [options] Options defining how to tokenize.
|
|
1211
|
+
* @returns {acorn.Program} The "Program" AST node.
|
|
1212
|
+
* @throws {EnhancedSyntaxError} If the input code is invalid.
|
|
1213
|
+
*/
|
|
1214
|
+
function parse(code, options) {
|
|
1215
|
+
const Parser = parsers.get(options);
|
|
1216
|
+
|
|
1217
|
+
return new Parser(options, code).parse();
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
//------------------------------------------------------------------------------
|
|
1221
|
+
// Public
|
|
1222
|
+
//------------------------------------------------------------------------------
|
|
1223
|
+
|
|
1224
|
+
/** @type {string} */
|
|
1225
|
+
const version = "11.1.0"; // x-release-please-version
|
|
1226
|
+
const name = "espree";
|
|
1227
|
+
|
|
1228
|
+
/* istanbul ignore next */
|
|
1229
|
+
/**
|
|
1230
|
+
* @type {visitorKeys.VisitorKeys}
|
|
1231
|
+
*/
|
|
1232
|
+
const VisitorKeys = (function() {
|
|
1233
|
+
return visitorKeys__namespace.KEYS;
|
|
1234
|
+
}());
|
|
1235
|
+
|
|
1236
|
+
// Derive node types from VisitorKeys
|
|
1237
|
+
/* istanbul ignore next */
|
|
1238
|
+
const Syntax = (function() {
|
|
1239
|
+
let key,
|
|
1240
|
+
|
|
1241
|
+
/** @type {Record<string,string>} */
|
|
1242
|
+
types = {};
|
|
1243
|
+
|
|
1244
|
+
if (typeof Object.create === "function") {
|
|
1245
|
+
types = Object.create(null);
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
for (key in VisitorKeys) {
|
|
1249
|
+
if (Object.hasOwn(VisitorKeys, key)) {
|
|
1250
|
+
types[key] = key;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
if (typeof Object.freeze === "function") {
|
|
1255
|
+
Object.freeze(types);
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
return types;
|
|
1259
|
+
}());
|
|
1260
|
+
|
|
1261
|
+
const latestEcmaVersion = getLatestEcmaVersion();
|
|
1262
|
+
|
|
1263
|
+
const supportedEcmaVersions = getSupportedEcmaVersions();
|
|
1264
|
+
|
|
1265
|
+
exports.Syntax = Syntax;
|
|
1266
|
+
exports.VisitorKeys = VisitorKeys;
|
|
1267
|
+
exports.latestEcmaVersion = latestEcmaVersion;
|
|
1268
|
+
exports.name = name;
|
|
1269
|
+
exports.parse = parse;
|
|
1270
|
+
exports.supportedEcmaVersions = supportedEcmaVersions;
|
|
1271
|
+
exports.tokenize = tokenize;
|
|
1272
|
+
exports.version = version;
|