eslint-plugin-oxlint
Advanced tools
Comparing version 0.2.9 to 0.3.0
@@ -1,8 +0,8 @@ | ||
import oxlint from "./index.cjs"; | ||
import unicorn from "eslint-plugin-unicorn"; | ||
import { FlatCompat } from "@eslint/eslintrc"; | ||
import eslint from "@eslint/js"; | ||
import eslintConfigPrettier from "eslint-config-prettier"; | ||
import oxlint from './lib/index.cjs'; | ||
import unicorn from 'eslint-plugin-unicorn'; | ||
import { FlatCompat } from '@eslint/eslintrc'; | ||
import eslint from '@eslint/js'; | ||
import eslintConfigPrettier from 'eslint-config-prettier'; | ||
const __dirname = new URL(".", import.meta.url).pathname; | ||
const __dirname = new URL('.', import.meta.url).pathname; | ||
const compat = new FlatCompat({ resolvePluginsRelativeTo: __dirname }); | ||
@@ -12,6 +12,6 @@ | ||
eslint.configs.recommended, | ||
unicorn.configs["flat/recommended"], | ||
...compat.extends("plugin:@typescript-eslint/recommended"), | ||
unicorn.configs['flat/recommended'], | ||
...compat.extends('plugin:@typescript-eslint/recommended'), | ||
eslintConfigPrettier, | ||
oxlint.configs["flat/recommended"], | ||
oxlint.configs['flat/all'], | ||
]; |
{ | ||
"name": "eslint-plugin-oxlint", | ||
"version": "0.2.9", | ||
"version": "0.3.0", | ||
"description": "Turn off all rules already supported by oxlint", | ||
"type": "module", | ||
"packageManager": "pnpm@8.13.1", | ||
"exports": { | ||
".": { | ||
"import": "./index.js", | ||
"require": "./index.cjs", | ||
"default": "./index.js", | ||
"types": "./index.d.ts" | ||
"import": "./lib/index.mjs", | ||
"require": "./lib/index.cjs", | ||
"default": "./lib/index.mjs", | ||
"types": "./lib/index.d.ts" | ||
}, | ||
"./rules": { | ||
"import": "./rules.js", | ||
"require": "./rules.cjs", | ||
"default": "./rules.js", | ||
"types": "./rules.d.ts" | ||
"./rules-by-category": { | ||
"import": "./lib/rules-by-category.mjs", | ||
"require": "./lib/rules-by-category.cjs", | ||
"default": "./lib/rules-by-category.mjs", | ||
"types": "./lib/rules-by-category.d.ts" | ||
}, | ||
"./rules-by-scope": { | ||
"import": "./lib/rules-by-scope.mjs", | ||
"require": "./lib/rules-by-scope.cjs", | ||
"default": "./lib/rules-by-scope.mjs", | ||
"types": "./lib/rules-by-scope.d.ts" | ||
} | ||
@@ -35,20 +40,25 @@ }, | ||
"devDependencies": { | ||
"@eslint/eslintrc": "^3.0.0", | ||
"@types/eslint": "^8.56.5", | ||
"@types/node": "^20.12.5", | ||
"@typescript-eslint/eslint-plugin": "^7.0.0", | ||
"@typescript-eslint/parser": "^6.16.0", | ||
"@vitest/coverage-v8": "^1.3.1", | ||
"axios": "^1.6.3", | ||
"bumpp": "^9.2.1", | ||
"eslint": "^8.56.0", | ||
"@eslint/eslintrc": "^3.1.0", | ||
"@types/eslint": "^8.56.10", | ||
"@types/node": "^20.12.12", | ||
"@types/shelljs": "^0.8.15", | ||
"@typescript-eslint/eslint-plugin": "^7.9.0", | ||
"@typescript-eslint/parser": "^7.9.0", | ||
"@vitest/coverage-v8": "^1.6.0", | ||
"bumpp": "^9.4.1", | ||
"dedent": "^1.5.3", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-unicorn": "^52.0.0", | ||
"eslint-plugin-unicorn": "^53.0.0", | ||
"husky": "^9.0.11", | ||
"lint-staged": "^15.2.0", | ||
"oxlint": "^0.2.17", | ||
"prettier": "^3.2.4", | ||
"tsx": "^4.7.2", | ||
"typescript": "^5.4.4", | ||
"vitest": "^1.3.1" | ||
"lint-staged": "^15.2.2", | ||
"memfs": "^4.9.2", | ||
"oxlint": "^0.3.5", | ||
"prettier": "^3.2.5", | ||
"shelljs": "^0.8.5", | ||
"tsx": "^4.10.5", | ||
"typescript": "^5.4.5", | ||
"vite": "^5.2.11", | ||
"vite-plugin-dts": "^3.9.1", | ||
"vitest": "^1.6.0" | ||
}, | ||
@@ -59,9 +69,14 @@ "lint-staged": { | ||
}, | ||
"dependencies": { | ||
"scule": "^1.3.0" | ||
}, | ||
"scripts": { | ||
"generate": "tsx ./scripts/generate-rules.ts", | ||
"generate": "tsx ./scripts/generate.ts", | ||
"clone": "tsx ./scripts/sparse-clone.ts", | ||
"build": "vite build", | ||
"lint": "npx oxlint && npx eslint", | ||
"format": "npx prettier --write .", | ||
"release": "bumpp package.json", | ||
"test": "vitest run" | ||
"test": "vitest --reporter=verbose" | ||
} | ||
} |
@@ -26,6 +26,6 @@ # eslint-plugin-oxlint | ||
// eslint.config.js | ||
import oxlint from "eslint-plugin-oxlint"; | ||
import oxlint from 'eslint-plugin-oxlint'; | ||
export default [ | ||
...// other plugins | ||
oxlint.configs["flat/recommended"], // oxlint should be the last one | ||
oxlint.configs['flat/recommended'], // oxlint should be the last one | ||
]; | ||
@@ -61,2 +61,37 @@ ``` | ||
## All Configs | ||
```js | ||
configs: { | ||
// recmmended only contains the `correctness` category | ||
recommended: { plugins: [Array], rules: [Object] }, | ||
'flat/recommended': { rules: [Object] }, | ||
// all rules available | ||
all: { plugins: [Array], rules: [Object] }, | ||
'flat/all': { rules: [Object] }, | ||
// turn eslint rules off by plugin | ||
'flat/eslint': { rules: [Object] }, | ||
'flat/import': { rules: [Object] }, | ||
'flat/jest': { rules: [Object] }, | ||
'flat/jsdoc': { rules: [Object] }, | ||
'flat/jsx-a11y': { rules: [Object] }, | ||
'flat/nextjs': { rules: [Object] }, | ||
'flat/react': { rules: [Object] }, | ||
'flat/react-perf': { rules: [Object] }, | ||
'flat/tree-shaking': { rules: [Object] }, | ||
'flat/typescript': { rules: [Object] }, | ||
'flat/unicorn': { rules: [Object] }, | ||
// turn eslint rules off by oxlint category | ||
'flat/pedantic': { rules: [Object] }, | ||
'flat/nursery': { rules: [Object] }, | ||
'flat/style': { rules: [Object] }, | ||
'flat/correctness': { rules: [Object] }, | ||
'flat/restriction': { rules: [Object] }, | ||
'flat/suspicious': { rules: [Object] } | ||
} | ||
``` | ||
## VSCode Support | ||
@@ -66,4 +101,25 @@ | ||
## Contributing | ||
sparse clone the oxlint repository to have a local copy | ||
```shell | ||
pnpm clone | ||
``` | ||
generates the rules from the sparse cloned Rust library, only for the latest version, | ||
new rules that haven't been released will not be included. | ||
```shell | ||
pnpm generate | ||
``` | ||
build cjs and esm versions of the library | ||
```shell | ||
pnpm build | ||
``` | ||
## License | ||
[MIT](https://github.com/Dunqing/eslint-plugin-oxlint/blob/main/LICENSE) |
@@ -1,18 +0,38 @@ | ||
import axios from "axios"; | ||
import shell from 'shelljs'; | ||
import { VERSION_PREFIX } from './constants.js'; | ||
import fs from 'node:fs'; | ||
export async function getLatestOxlintVersion() { | ||
const tagsUrl = "https://api.github.com/repos/oxc-project/oxc/tags"; | ||
const response = await axios.get(tagsUrl); | ||
const tags = response.data.map((tag: any) => tag.name); | ||
const oxlintTags: string[] = tags.filter((tag: string) => | ||
tag.startsWith("oxlint_v"), | ||
); | ||
const latestVersion = oxlintTags | ||
.slice(1) | ||
.reduce((latest: string, current: string) => { | ||
const latestNumber = parseInt(latest.replace("oxlint_v", "")); | ||
const currentNumber = parseInt(current.replace("oxlint_v", "")); | ||
return currentNumber > latestNumber ? current : latest; | ||
}, oxlintTags[0]); | ||
export function getLatestVersionFromClonedRepo( | ||
targetDirectory: string, | ||
versionPrefix = VERSION_PREFIX | ||
) { | ||
if (!fs.existsSync(targetDirectory)) { | ||
return ''; | ||
} | ||
shell.cd(targetDirectory); | ||
const oxlintTags = shell | ||
.exec( | ||
`git describe --tags --match='${versionPrefix}*' $(git rev-list --tags)`, | ||
{ | ||
silent: true, | ||
} | ||
) | ||
.stdout.trim() | ||
.split('\n'); | ||
let latestVersion = oxlintTags[0]; | ||
for (let index = 1; index < oxlintTags.length; index++) { | ||
const current = oxlintTags[index]; | ||
const latestNumber = Number.parseInt( | ||
latestVersion.replace(versionPrefix, '') | ||
); | ||
const currentNumber = Number.parseInt(current.replace(versionPrefix, '')); | ||
if (currentNumber > latestNumber) { | ||
latestVersion = current; | ||
} | ||
} | ||
return latestVersion; | ||
} |
{ | ||
"compilerOptions": { | ||
/* Visit https://aka.ms/tsconfig to read more about this file */ | ||
/* Projects */ | ||
@@ -12,3 +11,2 @@ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ | ||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ | ||
/* Language and Environment */ | ||
@@ -27,3 +25,2 @@ "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, | ||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ | ||
/* Modules */ | ||
@@ -47,3 +44,2 @@ "module": "NodeNext" /* Specify what module code is generated. */, | ||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */ | ||
/* JavaScript Support */ | ||
@@ -53,3 +49,2 @@ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ | ||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ | ||
/* Emit */ | ||
@@ -79,3 +74,2 @@ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ | ||
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ | ||
/* Interop Constraints */ | ||
@@ -88,3 +82,2 @@ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ | ||
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, | ||
/* Type Checking */ | ||
@@ -110,7 +103,7 @@ "strict": true /* Enable all strict type-checking options. */, | ||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ | ||
/* Completeness */ | ||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ | ||
"skipLibCheck": true /* Skip type checking all .d.ts files. */, | ||
"skipLibCheck": true /* Skip type checking all .d.ts files. */ | ||
}, | ||
"exclude": ["lib"] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
177972
48
3969
123
1
23
1
+ Addedscule@^1.3.0
+ Addedscule@1.3.0(transitive)