{"name":"eslint-compat-utils","version":"0.6.2","keywords":["eslint"],"author":{"url":"https://github.com/ota-meshi","name":"Yosuke Ota"},"license":"MIT","_id":"eslint-compat-utils@0.6.2","homepage":"https://github.com/ota-meshi/eslint-compat-utils#readme","bugs":{"url":"https://github.com/ota-meshi/eslint-compat-utils/issues"},"dist":{"shasum":"4eeb3c3bd6a6142a5ddf8ea18e9e367e5f6ede43","tarball":"http://registry-npm.ywwl.com/eslint-compat-utils/download/eslint-compat-utils-0.6.2.tgz","fileCount":29,"integrity":"sha512-/9rDF9IS6Z4yph7nZbyjitfJ4A4b6v9AUybT5rWDmnc9WzYaNkq/SJFWOAai5isYmsZ5IfrzrsK+6gheG6LqVQ==","signatures":[{"sig":"MEQCIGlhRbwNona1p9Tw/Nsd0HKnlbuiAczCHFmzzgyxLw7KAiBB9S17BQXiApvpQUqy6HMP7DXDYAu7Sm0GMc6D4yow6A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":53923,"size":12755,"noattachment":false,"key":"/eslint-compat-utils/-/eslint-compat-utils-0.6.2.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":"fade9405a8df6e0e52c7eb9b59f137b9f012bd37","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 .","release":"changeset publish","prebuild":"npm run -s clean","eslint-fix":"eslint . --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.8.2","description":"Provides an API for ESLint custom rules that is compatible with the latest ESLint even when using older ESLint.","directories":{},"_nodeVersion":"18.20.5","dependencies":{"semver":"^7.5.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^17.0.0","mocha":"^10.2.0","eslint":"^9.14.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":"^9.0.0","@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","typescript-eslint":"^8.13.0","eslint-plugin-jsdoc":"^50.4.3","eslint-plugin-jsonc":"^2.9.0","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.0","@ota-meshi/eslint-plugin":"^0.17.5","eslint-plugin-node-dependencies":"^0.12.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.2_1731839574778_0.8634451087050126","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":1731839574970,"maintainers":[{"name":"ota-meshi","email":"otameshiyo23@gmail.com"}],"_cnpm_publish_time":1731839574970,"dist-tags":{"latest":"0.6.5"}}