forked from oxc-project/eslint-plugin-oxlint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Git Sparse checkout to make it easier to get the local rules (oxc…
…-project#64) * Make prettier work with this repo * sparse clone and remove axios dependency * make code more readable, add spaces. * traverse all rules and return them grouped, preparing for "recommended/restriction" and "recommended/correctness" etc ... * fix snapshot * rules by category / rules by scope * Add all the configs * use vite to build ESM and CJS instead of duplicating. * only provide coverage for the files we care about * more tests, more cleanup * new build. should this really be committed though * feat: update * chore: downgrades eslint --------- Co-authored-by: Qing <[email protected]> Co-authored-by: Dunqing <[email protected]>
- Loading branch information
1 parent
b0d5e86
commit 9a17ad9
Showing
50 changed files
with
5,003 additions
and
1,022 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Bump oxlint | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- labeled | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: write | ||
|
||
env: | ||
OXLINT_PACKAGE_NAME: oxlint | ||
|
||
jobs: | ||
bump-oxlint-rules: | ||
runs-on: ubuntu-latest | ||
if: github.actor == 'dependabot[bot]' && github.event.label.name == 'dependencies' | ||
steps: | ||
- name: Dependabot metadata | ||
id: metadata | ||
uses: dependabot/fetch-metadata@v1 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: actions/checkout@v4 | ||
if: contains(steps.metadata.outputs.dependency-names, env.OXLINT_PACKAGE_NAME) | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
|
||
- name: Install pnpm | ||
if: contains(steps.metadata.outputs.dependency-names, env.OXLINT_PACKAGE_NAME) | ||
uses: pnpm/action-setup@v2 | ||
|
||
- name: Set node | ||
if: contains(steps.metadata.outputs.dependency-names, env.OXLINT_PACKAGE_NAME) | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .node-version | ||
cache: pnpm | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Install Dependencies | ||
if: contains(steps.metadata.outputs.dependency-names, env.OXLINT_PACKAGE_NAME) | ||
run: pnpm i | ||
|
||
- name: Bump oxlint rules | ||
if: contains(steps.metadata.outputs.dependency-names, env.OXLINT_PACKAGE_NAME) | ||
run: | | ||
# Generate rules from latest oxlint | ||
pnpm run generate | ||
# Update test snapshots | ||
pnpm run test -u | ||
# Commit and push changes | ||
git config --global user.name "dependabot[bot]" | ||
git config --global user.email "49699333+dependabot[bot]@users.noreply.github.com" | ||
git commit -am "feat(oxlint): bump oxlint rules" | ||
git push | ||
# Edit title message for changelog purpose | ||
gh pr edit "$PR_URL" --title "feat(oxlint): bump oxlint rules" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,3 +131,5 @@ dist | |
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
.oxc_sparse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[tools] | ||
pnpm = "9.0.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
// Editor values | ||
"editor.formatOnSave": true, | ||
// Eslint Configuration | ||
"eslint.workingDirectories": ["."], | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit", | ||
"source.organizeImports": "never" | ||
}, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"eslint.validate": ["javascript", "typescript"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
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 }); | ||
|
||
export default [ | ||
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'], | ||
]; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
const rulesByScope = require('./rules-by-scope.cjs'); | ||
const rulesByCategory = require('./rules-by-category.cjs'); | ||
const utils = require('./utils.cjs'); | ||
const allRules = Object.assign({}, ...Object.values(rulesByScope)); | ||
const index = { | ||
configs: { | ||
recommended: { | ||
plugins: ['oxlint'], | ||
rules: rulesByCategory.correctnessRules, | ||
}, | ||
all: { | ||
plugins: ['oxlint'], | ||
rules: allRules, | ||
}, | ||
'flat/all': { | ||
rules: allRules, | ||
}, | ||
'flat/recommended': { | ||
rules: rulesByCategory.correctnessRules, | ||
}, | ||
...utils.createFlatRulesConfig(rulesByScope), | ||
...utils.createFlatRulesConfig(rulesByCategory), | ||
}, | ||
}; | ||
module.exports = index; |
Oops, something went wrong.