{"name":"eslint-compat-utils","version":"0.6.0","keywords":["eslint"],"author":{"url":"https://github.com/ota-meshi","name":"Yosuke Ota"},"license":"MIT","_id":"eslint-compat-utils@0.6.0","homepage":"https://github.com/ota-meshi/eslint-compat-utils#readme","bugs":{"url":"https://github.com/ota-meshi/eslint-compat-utils/issues"},"dist":{"shasum":"d7beb1bdefd91c3753bf2fa050575d8b755d6845","tarball":"http://registry-npm.ywwl.com/eslint-compat-utils/download/eslint-compat-utils-0.6.0.tgz","fileCount":29,"integrity":"sha512-1vVBdI/HLS6HTHVQCJGlN+LOF0w1Rs/WB9se23mQr84cRM0iMM8PulMFFhQdQ1BvS0cGwjpis4xziI91Rk0l6g==","signatures":[{"sig":"MEQCIAb3ohPfhYFdXEsP6zoh0RxWjfyN6uYQdF7LxQjTXoGYAiApeP/jpl+gYgdly3mAnJya8NmoVl+SaNm+9j8Be3BOqg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53753,"size":12699,"noattachment":false,"key":"/eslint-compat-utils/-/eslint-compat-utils-0.6.0.tgz"},"main":"./dist/index.cjs","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=12"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"},"./eslint":{"types":"./dist/eslint.d.ts","import":"./dist/eslint.mjs","require":"./dist/eslint.cjs"},"./linter":{"types":"./dist/linter.d.ts","import":"./dist/linter.mjs","require":"./dist/linter.cjs"},"./rule-tester":{"types":"./dist/rule-tester.d.ts","import":"./dist/rule-tester.mjs","require":"./dist/rule-tester.cjs"},"./package.json":"./package.json"},"gitHead":"58a58ccf129010d1f2099edea5c67a6589d0907d","scripts":{"ts":"node -r esbuild-register","lint":"npm-run-all \"lint:*\"","test":"npm run mocha -- \"tests/src/**/*.ts\" --reporter dot --timeout 60000","build":"unbuild","clean":"rimraf .nyc_output dist coverage","mocha":"npm run ts -- ./node_modules/mocha/bin/mocha.js","lint:js":"eslint . --ext .js,.mjs,.ts,.json,.yml,.yaml","release":"changeset publish","prebuild":"npm run -s clean","eslint-fix":"eslint . --ext .js,.mjs,.ts,.json,.yml,.yaml --fix","prerelease":"npm run clean && npm run build","test:cover":"nyc --reporter=lcov npm run test","update:extract-v6-props":"npm run ts -- tools/extract-v6-props.ts"},"_npmUser":{"name":"ota-meshi","email":"otameshiyo23@gmail.com"},"repository":{"url":"git+https://github.com/ota-meshi/eslint-compat-utils.git","type":"git"},"_npmVersion":"10.7.0","description":"Provides an API for ESLint custom rules that is compatible with the latest ESLint even when using older ESLint.","directories":{},"_nodeVersion":"18.20.4","dependencies":{"semver":"^7.5.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^17.0.0","mocha":"^10.2.0","eslint":"^8.56.0","unbuild":"^2.0.0","prettier":"^3.0.3","@types/node":"^22.0.0","@types/mocha":"^10.0.0","npm-run-all2":"^7.0.0","@types/eslint":"^8.44.3","@types/semver":"^7.5.8","@changesets/cli":"^2.26.2","eslint-plugin-n":"^17.0.0","esbuild-register":"^3.5.0","eslint-plugin-yml":"^1.9.0","eslint-plugin-jsonc":"^2.9.0","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.0","@ota-meshi/eslint-plugin":"^0.15.0","@typescript-eslint/parser":"^8.0.0","@typescript-eslint/eslint-plugin":"^8.0.0","eslint-plugin-json-schema-validator":"^5.0.0","@svitejs/changesets-changelog-github-compact":"^1.1.0"},"peerDependencies":{"eslint":">=6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/eslint-compat-utils_0.6.0_1730809619359_0.3442152940235501","host":"s3://npm-registry-packages"},"readme":"# eslint-compat-utils\n\n***This package is still in the experimental stage.***\n\nProvides an API for ESLint custom rules that is compatible with the latest ESLint even when using older ESLint.\n\n## Installation\n\n```bash\nnpm install eslint-compat-utils\n```\n\n## Usage\n\n```js\nconst { getSourceCode } = require(\"eslint-compat-utils\");\nmodule.exports = {\n  meta: { /* ... */ },\n  create(context) {\n    const sourceCode = getSourceCode(context)\n    return {\n      \"Program\"(node) {\n        const scope = sourceCode.getScope(node);\n      },\n    };\n  },\n}\n```\n\n### API\n\n#### `getSourceCode(context)`\n\nReturns an extended instance of `context.sourceCode` or the result of `context.getSourceCode()`. Extended instances can use new APIs such as `getScope(node)` even with old ESLint.\n\n#### `getCwd(context)`\n\nGets the value of `context.cwd`, but for older ESLint it returns the result of `context.getCwd()`.\nVersions older than v6.6.0 return a value from the result of `process.cwd()`.\n\n#### `getFilename(context)`\n\nGets the value of `context.filename`, but for older ESLint it returns the result of `context.getFilename()`.\n\n#### `getPhysicalFilename(context)`\n\nGets the value of `context.physicalFilename`, but for older ESLint it returns the result of `context.getPhysicalFilename()`.\nVersions older than v7.28.0 return a value guessed from the result of `context.getFilename()`, but it may be incorrect.\n","publish_time":1730809619557,"maintainers":[{"name":"ota-meshi","email":"otameshiyo23@gmail.com"}],"_cnpm_publish_time":1730809619557,"dist-tags":{"latest":"0.6.5"}}