{"name":"astro-eslint-parser","version":"0.9.3","keywords":["astro","astrojs","eslint","parser"],"author":{"name":"Yosuke Ota"},"license":"MIT","_id":"astro-eslint-parser@0.9.3","maintainers":[{"name":"ota-meshi","email":"otameshiyo23@gmail.com"}],"homepage":"https://github.com/ota-meshi/astro-eslint-parser#readme","bugs":{"url":"https://github.com/ota-meshi/astro-eslint-parser/issues"},"dist":{"shasum":"2ad281f6fd43efef1277f2ee894de7a2b0fd3f46","tarball":"http://registry-npm.ywwl.com/astro-eslint-parser/download/astro-eslint-parser-0.9.3.tgz","fileCount":6,"integrity":"sha512-w0Z8ydKT58l4950AikxDkuWmtBACen2nJWY8GjwhMcJGtGgKw+Kbbr5/RJsXu0BnCxo9Ks+5o4JZjQpzRUMYCg==","signatures":[{"sig":"MEUCIQCp1FevdKDcdRK3ccryKIMbGQwIt6KboBWCAJOWYUTddwIgKorN2ShPx/5UaRedXpMz70h91c9sNvF2neMIQxm6+sg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":163616,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuDVSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr2+A//fn57xI+gjg7WFQE74Qo2ce6rdrVduKO4cOS9rgwKHRurRVHG\r\n80vKW6w4LmWYod8D+RHy6ZowqS9U7zMKGOsvYdcsnVI0olwL0U0yhWcFt2V5\r\noy8bRf5AeSX/OgoOmUuy1ccmKbO6VBKCb4X+f7sKly/y26QQS8iLSBgYE146\r\nA6mpVJQx1AKVugaV0QFubTx8g/7E+7/rFR6JtJqU+e+OGjE0jmYprnDsZean\r\nSocZ4+Ughm79/yJN8AUhYJEw9m2q5uBZIiwxfUOcnhiNM2/VgqH6WLZX/QVL\r\nqE4qjKLj1IZbfsShx3H2CletRs5KUGUomiPLNnBBcPS7SNUahlcAEA7fs3Qm\r\np4CScA5exfoMfN18GTULEipmjsSSpK14jjv7L5+z1JbMIVsJW66YE67+IwYt\r\n/AjkOFg2hoLk45FTnT5uPPZJGql3ecU6i9D5rvER3jGnzQNbg3Hy27Sk9ZaS\r\n0pkRN+dtw3IhE6YC0G6GbM2w2bS7dbnceKly3MeyJSqRZWi7a2iR8dG9mslt\r\nkQJMuIwbJP3j7My2jRBjtUB79gXsaXEToOLwh5SLWyjZb+RZLbpsNmQuQE3k\r\nKn05Fa1E7Xe/DeDXrRnVqWL2SVXDRLg77GnpLkKTilkBR/N/1AK9TOWKUjYF\r\nuwY2GaBi7qUMdTPSvDRY2qt3/gGb4F2jp4A=\r\n=t18D\r\n-----END PGP SIGNATURE-----\r\n","size":35023,"noattachment":false,"key":"/astro-eslint-parser/-/astro-eslint-parser-0.9.3.tgz"},"main":"lib/index.js","types":"./lib/index.d.ts","module":"lib/index.mjs","engines":{"node":"^14.18.0 || >=16.0.0"},"funding":"https://github.com/sponsors/ota-meshi","gitHead":"4a0c8b89ed94816cca8bb41e44af2a080a1eeba5","scripts":{"ts":"env-cmd -e basic node -r esbuild-register","lint":"eslint . --ext .js,.ts,.json,.astro,.svelte","test":"npm run mocha -- \"tests/src/**/*.ts\" --reporter dot --timeout 60000","build":"tsup","clean":"rimraf .nyc_output lib coverage","cover":"nyc --reporter=lcov npm run test","debug":"npm run mocha -- \"tests/src/**/*.ts\" --reporter dot --timeout 60000","mocha":"npm run ts -- ./node_modules/mocha/bin/mocha.js","release":"changeset publish","prebuild":"npm run -s clean","benchmark":"npm run ts -- benchmark/index.ts","eslint-fix":"npm run lint -- --fix","prerelease":"npm run clean && npm run build","preversion":"npm run lint && npm test","debug-parser":"npm run ts -- ./tools/parser-test.ts","update-fixtures":"env-cmd -e debug npm run ts -- ./tools/update-fixtures.ts","eslint-playground":"eslint tests/fixtures --ext .astro --config .eslintrc-for-playground.js --format codeframe"},"_npmUser":{"name":"ota-meshi","email":"otameshiyo23@gmail.com"},"repository":{"url":"git+https://github.com/ota-meshi/astro-eslint-parser.git","type":"git"},"_npmVersion":"8.19.2","description":"Astro component parser for ESLint","directories":{},"_nodeVersion":"16.18.1","dependencies":{"debug":"^4.3.4","espree":"^9.0.0","eslint-scope":"^7.1.1","@astrojs/compiler":"^0.27.0 || ^0.28.0 || ^0.29.0 || ^0.30.0 || ^0.31.0","eslint-visitor-keys":"^3.0.0","astrojs-compiler-sync":"^0.3.0","@typescript-eslint/types":"^5.25.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","chai":"^4.3.4","tsup":"^6.2.3","astro":"^1.6.1","mocha":"^10.0.0","eslint":"^8.15.0","semver":"^7.3.5","svelte":"^3.48.0","env-cmd":"^10.1.0","esbuild":"^0.16.0","code-red":"^0.2.3","prettier":"^2.0.5","benchmark":"^2.1.4","typescript":"~4.9.0","@types/chai":"^4.3.0","@types/node":"^18.0.0","@types/debug":"^4.1.7","@types/mocha":"^10.0.0","magic-string":"^0.27.0","@types/eslint":"^8.0.0","@types/semver":"^7.3.9","estree-walker":"^3.0.0","@changesets/cli":"^2.24.2","@types/benchmark":"^2.1.1","esbuild-register":"^3.3.3","locate-character":"^2.0.5","eslint-plugin-node":"^11.1.0","@types/eslint-scope":"^3.7.0","astro-eslint-parser":">=0.1.0","eslint-plugin-astro":"^0.21.0","eslint-plugin-jsonc":"^2.0.0","eslint-plugin-react":"^7.29.4","eslint-plugin-regexp":"^1.5.0","eslint-plugin-svelte":"^2.0.0","prettier-plugin-astro":"^0.7.0","string-replace-loader":"^3.0.3","eslint-config-prettier":"^8.3.0","eslint-plugin-jsx-a11y":"^6.5.1","eslint-plugin-prettier":"^4.0.0","prettier-plugin-svelte":"^2.7.0","@ota-meshi/eslint-plugin":"^0.13.0","mocha-chai-jest-snapshot":"^1.1.3","@typescript-eslint/parser":"~5.48.0","@types/eslint-visitor-keys":"^1.0.0","eslint-formatter-codeframe":"^7.32.1","@changesets/changelog-github":"^0.4.6","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-node-dependencies":"^0.10.0","@typescript-eslint/eslint-plugin":"~5.48.0","eslint-plugin-simple-import-sort":"^8.0.0","eslint-plugin-json-schema-validator":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/astro-eslint-parser_0.9.3_1673016658403_0.7286872636392678","host":"s3://npm-registry-packages"},"readme":"# astro-eslint-parser\n\n[Astro] component parser for [ESLint].  \nYou can check it on [Online DEMO](https://ota-meshi.github.io/astro-eslint-parser/playground).\n\n[![sponsors](https://img.shields.io/badge/-Sponsor-fafbfc?logo=GitHub%20Sponsors)](https://github.com/sponsors/ota-meshi)\n\n[![NPM license](https://img.shields.io/npm/l/astro-eslint-parser.svg)](https://www.npmjs.com/package/astro-eslint-parser)\n[![NPM version](https://img.shields.io/npm/v/astro-eslint-parser.svg)](https://www.npmjs.com/package/astro-eslint-parser)\n[![NPM downloads](https://img.shields.io/badge/dynamic/json.svg?label=downloads&colorB=green&suffix=/day&query=$.downloads&uri=https://api.npmjs.org//downloads/point/last-day/astro-eslint-parser&maxAge=3600)](http://www.npmtrends.com/astro-eslint-parser)\n[![NPM downloads](https://img.shields.io/npm/dw/astro-eslint-parser.svg)](http://www.npmtrends.com/astro-eslint-parser)\n[![NPM downloads](https://img.shields.io/npm/dm/astro-eslint-parser.svg)](http://www.npmtrends.com/astro-eslint-parser)\n[![NPM downloads](https://img.shields.io/npm/dy/astro-eslint-parser.svg)](http://www.npmtrends.com/astro-eslint-parser)\n[![NPM downloads](https://img.shields.io/npm/dt/astro-eslint-parser.svg)](http://www.npmtrends.com/astro-eslint-parser)\n[![Build Status](https://github.com/ota-meshi/astro-eslint-parser/workflows/CI/badge.svg?branch=main)](https://github.com/ota-meshi/astro-eslint-parser/actions?query=workflow%3ACI)\n[![Coverage Status](https://coveralls.io/repos/github/ota-meshi/astro-eslint-parser/badge.svg?branch=main)](https://coveralls.io/github/ota-meshi/astro-eslint-parser?branch=main)\n\nThis parser is in the ***experimental stages*** of development.\n\nAt least it works fine with a [withastro/docs](https://github.com/withastro/docs) repository.\n\n\n## :checkered_flag: Motivation\n\nThis parser allows us to lint the script of `.astro` files.\n\n> Note that this parser alone will not lint the scripts inside the `<script>` tag. Use [eslint-plugin-astro] to lint the script inside the `<script>` tag as well.\n\n### ESLint Plugins Using astro-eslint-parser\n\n#### [eslint-plugin-astro]\n\nESLint plugin for Astro component.  \n\n## 💿 Installation\n\n```bash\nnpm install --save-dev eslint astro-eslint-parser\n```\n\nThis package is ESM-only. Use `import` to load it from JavaScript config files.\nCommonJS `require(\"astro-eslint-parser\")` is not supported.\n\n## 📖 Usage\n\n**First, we recommend using [eslint-plugin-astro] rather than just the parser.**  \nThe following examples are for introducing only the parser. This is not useful for most people. It can be useful if you create your own plugin.\n\n1. Configure `languageOptions.parser` for `.astro` files in your `eslint.config.*` file.\n\n    ```js\n    import * as astroParser from \"astro-eslint-parser\"\n\n    export default [\n        {\n            files: [\"**/*.astro\"],\n            languageOptions: {\n                parser: astroParser,\n            },\n        },\n    ]\n    ```\n\n2. If you have specified the extension in the CLI, add `.astro` as well.\n\n    ```console\n    $ eslint \"src/**/*.{js,astro}\"\n    # or\n    $ eslint src --ext .js,.astro\n    ```\n\nThe commit diff [here](https://github.com/withastro/astro.build/compare/main...ota-meshi:eslint) is an example of introducing this parser to the `astro.build` repository.\n\n### Public API\n\nImport this package from the package root:\n\n```js\nimport * as astroParser from \"astro-eslint-parser\"\n```\n\n## 🔧 Options\n\n`parserOptions` has the same properties as what [espree](https://github.com/eslint/espree#usage), the default parser of ESLint, is supporting.\nFor example:\n\n```js\nimport * as astroParser from \"astro-eslint-parser\"\n\nexport default [\n    {\n        files: [\"**/*.astro\"],\n        languageOptions: {\n            parser: astroParser,\n            parserOptions: {\n                sourceType: \"module\",\n                ecmaVersion: 2021,\n                ecmaFeatures: {\n                    globalReturn: false,\n                    impliedStrict: false,\n                    jsx: false,\n                },\n            },\n        },\n    },\n]\n```\n\n### parserOptions.parser\n\nYou can use `parserOptions.parser` property to specify a custom parser to parse scripts.\nOther properties than parser would be given to the specified parser.\nFor example:\n\n```js\nimport * as astroParser from \"astro-eslint-parser\"\n\nexport default [\n    {\n        files: [\"**/*.astro\"],\n        languageOptions: {\n            parser: astroParser,\n            parserOptions: {\n                parser: \"@typescript-eslint/parser\",\n            },\n        },\n    },\n]\n```\n\nFor example, if you are using the `\"@typescript-eslint/parser\"`, and if you want to use TypeScript in `.astro`, you need to add more `parserOptions` configuration.\n\n```js\nimport tsParser from \"@typescript-eslint/parser\"\nimport * as astroParser from \"astro-eslint-parser\"\n\nexport default [\n    {\n        files: [\"**/*.astro\"],\n        languageOptions: {\n            parser: astroParser,\n            parserOptions: {\n                parser: tsParser,\n                project: \"path/to/your/tsconfig.json\",\n                extraFileExtensions: [\".astro\"],\n            },\n        },\n    },\n]\n```\n\nYou can also give different parsers for different languages.\n\n```js\nimport tsParser from \"@typescript-eslint/parser\"\nimport * as astroParser from \"astro-eslint-parser\"\n\nexport default [\n    {\n        files: [\"**/*.astro\"],\n        languageOptions: {\n            parser: astroParser,\n            parserOptions: {\n                parser: {\n                    ts: tsParser,\n                    js: \"espree\",\n                },\n            },\n        },\n    },\n]\n```\n\n## :computer: Editor Integrations\n\n### Visual Studio Code\n\nUse the [dbaeumer.vscode-eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension that Microsoft provides officially.\n\nYou have to configure the `eslint.validate` option of the extension to check `.astro` files, because the extension targets only `*.js` or `*.jsx` files by default.\n\nExample **.vscode/settings.json**:\n\n```json\n{\n    \"eslint.validate\": [\n        \"javascript\",\n        \"javascriptreact\",\n        \"astro\"\n    ]\n}\n```\n\n## :handshake: Compatibility With Existing ESLint Rules\n\nMost of the rules in the ESLint core work for the script part, but some rules are incompatible.  \nThis parser will generate a JSX compatible AST for most of the HTML part of the Astro component. Therefore, some rules of [eslint-plugin-react] may work.\nFor example, the [react/jsx-no-target-blank] rule works fine.  \n\n[eslint-plugin-react]: https://github.com/jsx-eslint/eslint-plugin-react/\n[react/jsx-no-target-blank]: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md\n\n## :ghost: Limitations\n\nIf this parser is used with `@typescript-eslint/parser` and `parserOptions.project` is set, it will temporarily create a `.tsx` file to parse the `.astro` file.  \nThis parser works by converting the `.astro` file to JSX and letting the JavaScript parser parse it.\nSince `@typescript-eslint/parser` can only parse files with the extension `.tsx` as JSX, it is necessary to temporarily create a `.tsx` file. Temporarily created files will try to be deleted after parses, but if the parsing takes a long time, the files may be visible to you.\n\nSee also [`@typescript-eslint/parser` readme](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/parser#parseroptionsecmafeaturesjsx).\n\n## :hammer_and_wrench: Usage for Custom Rules / Plugins\n\n<!-- - [AST.md](./docs/AST.md) is AST specification. You can check it on the [Online DEMO](https://ota-meshi.github.io/astro-eslint-parser/). -->\n\n- TBA\n- You can check the AST in the [Online DEMO](https://ota-meshi.github.io/astro-eslint-parser/). However, AST is subject to major changes in the future.\n- I have already [implemented some rules] in the [eslint-plugin-astro]. The source code for these rules will be helpful to you.\n\n## :beers: Contributing\n\nWelcome contributing!\n\nPlease use GitHub's Issues/PRs.\n\n## :heart: Supporting\n\nIf you are willing to see that this package continues to be maintained, please consider sponsoring me.\n\n[![sponsors](https://img.shields.io/badge/-Sponsor-fafbfc?logo=GitHub%20Sponsors)](https://github.com/sponsors/ota-meshi)\n\n## :lock: License\n\nSee the [LICENSE](LICENSE) file for license rights and limitations (MIT).\n\n[Astro]: https://astro.build/\n[ESLint]: https://eslint.org/\n[eslint-plugin-astro]: https://ota-meshi.github.io/eslint-plugin-astro/\n[implemented some rules]: https://ota-meshi.github.io/eslint-plugin-astro/rules/\n","publish_time":1673016658651,"_cnpm_publish_time":1673016658651,"dist-tags":{"latest":"3.2.0"}}