Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: fix generate rules after rules with same names are allowed #262

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion scripts/sparse-clone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

const checkoutVersion = process.argv[2] ?? version;

const NON_VERSION_TAGS = ['main'];

Check failure on line 21 in scripts/sparse-clone.ts

View workflow job for this annotation

GitHub Actions / lint

`NON_VERSION_TAGS` should be a `Set`, and use `NON_VERSION_TAGS.has()` to check existence or non-existence

// Function to initialize or reconfigure sparse-checkout
function configureSparseCheckout(cloneDirectory: string) {
console.log('Configuring sparse-checkout...');
Expand All @@ -38,7 +40,9 @@
}

function checkoutVersionTag(version: string) {
const tag = `${VERSION_PREFIX}${version}`;
const tag = NON_VERSION_TAGS.includes(version)
? version
: `${VERSION_PREFIX}${version}`;

// Checkout the specified directory
if (shell.exec(`git checkout ${tag}`, { silent: true }).code !== 0) {
Expand All @@ -56,6 +60,9 @@
cloneDirectory: string,
version: string
) {
if (NON_VERSION_TAGS.includes(version)) {
shell.exec(`rm -f ${targetDirectory}`);
}
// Check if the target directory exists and is a Git repository
if (
fs.existsSync(targetDirectory) &&
Expand Down
21 changes: 15 additions & 6 deletions src/__snapshots__/configs.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ exports[`contains all the oxlint rules 1`] = `
"@typescript-eslint/ban-types": [
0,
],
"@typescript-eslint/consistent-generic-constructors": [
0,
],
"@typescript-eslint/consistent-indexed-object-style": [
0,
],
Expand Down Expand Up @@ -128,6 +131,9 @@ exports[`contains all the oxlint rules 1`] = `
"@typescript-eslint/no-import-type-side-effects": [
0,
],
"@typescript-eslint/no-inferrable-types": [
0,
],
"@typescript-eslint/no-loss-of-precision": [
0,
],
Expand Down Expand Up @@ -167,6 +173,9 @@ exports[`contains all the oxlint rules 1`] = `
"@typescript-eslint/no-unsafe-function-type": [
0,
],
"@typescript-eslint/no-unused-expressions": [
0,
],
"@typescript-eslint/no-unused-vars": [
0,
],
Expand Down Expand Up @@ -244,9 +253,6 @@ exports[`contains all the oxlint rules 1`] = `
"import/first": [
0,
],
"import/import-no-namespace": [
0,
],
"import/max-dependencies": [
0,
],
Expand Down Expand Up @@ -280,6 +286,9 @@ exports[`contains all the oxlint rules 1`] = `
"import/no-named-as-default-member": [
0,
],
"import/no-namespace": [
0,
],
"import/no-self-import": [
0,
],
Expand Down Expand Up @@ -911,6 +920,9 @@ exports[`contains all the oxlint rules 1`] = `
"prefer-object-has-own": [
0,
],
"prefer-spread": [
0,
],
"promise/avoid-new": [
0,
],
Expand Down Expand Up @@ -1326,9 +1338,6 @@ exports[`contains all the oxlint rules 1`] = `
"unicorn/prefer-set-size": [
0,
],
"unicorn/prefer-spread": [
0,
],
"unicorn/prefer-string-raw": [
0,
],
Expand Down
7 changes: 5 additions & 2 deletions src/generated/rules-by-category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ const restrictionRules = {
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/prefer-literal-enum-member': 'off',
'unicorn/no-abusive-eslint-disable': 'off',
Expand Down Expand Up @@ -158,10 +159,11 @@ const styleRules = {
'prefer-exponentiation-operator': 'off',
'prefer-numeric-literals': 'off',
'prefer-object-has-own': 'off',
'prefer-spread': 'off',
'sort-imports': 'off',
'sort-keys': 'off',
'import/first': 'off',
'import/import-no-namespace': 'off',
'import/no-namespace': 'off',
'jest/consistent-test-it': 'off',
'jest/max-expects': 'off',
'jest/max-nested-describe': 'off',
Expand Down Expand Up @@ -211,11 +213,13 @@ const styleRules = {
'@typescript-eslint/adjacent-overload-signatures': 'off',
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/ban-tslint-comment': 'off',
'@typescript-eslint/consistent-generic-constructors': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/default-param-last': 'off',
'@typescript-eslint/max-params': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-magic-numbers': 'off',
'@typescript-eslint/prefer-for-of': 'off',
'@typescript-eslint/prefer-function-type': 'off',
Expand All @@ -240,7 +244,6 @@ const styleRules = {
'unicorn/prefer-negative-index': 'off',
'unicorn/prefer-optional-catch-binding': 'off',
'unicorn/prefer-reflect-apply': 'off',
'unicorn/prefer-spread': 'off',
'unicorn/prefer-string-raw': 'off',
'unicorn/prefer-string-trim-start-end': 'off',
'unicorn/prefer-structured-clone': 'off',
Expand Down
7 changes: 5 additions & 2 deletions src/generated/rules-by-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const eslintRules = {
'prefer-exponentiation-operator': 'off',
'prefer-numeric-literals': 'off',
'prefer-object-has-own': 'off',
'prefer-spread': 'off',
radix: 'off',
'require-await': 'off',
'require-yield': 'off',
Expand All @@ -118,7 +119,6 @@ const eslintRules = {
const importRules = {
'import/default': 'off',
'import/first': 'off',
'import/import-no-namespace': 'off',
'import/max-dependencies': 'off',
'import/named': 'off',
'import/namespace': 'off',
Expand All @@ -130,6 +130,7 @@ const importRules = {
'import/no-dynamic-require': 'off',
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off',
'import/no-namespace': 'off',
'import/no-self-import': 'off',
'import/no-webpack-loader-syntax': 'off',
'import/unambiguous': 'off',
Expand Down Expand Up @@ -325,6 +326,7 @@ const typescriptRules = {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-tslint-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/consistent-generic-constructors': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/default-param-last': 'off',
Expand All @@ -342,6 +344,7 @@ const typescriptRules = {
'@typescript-eslint/no-extra-non-null-assertion': 'off',
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/no-import-type-side-effects': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-loss-of-precision': 'off',
'@typescript-eslint/no-magic-numbers': 'off',
'@typescript-eslint/no-misused-new': 'off',
Expand All @@ -355,6 +358,7 @@ const typescriptRules = {
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
'@typescript-eslint/no-unsafe-declaration-merging': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-useless-constructor': 'off',
'@typescript-eslint/no-useless-empty-export': 'off',
Expand Down Expand Up @@ -450,7 +454,6 @@ const unicornRules = {
'unicorn/prefer-regexp-test': 'off',
'unicorn/prefer-set-has': 'off',
'unicorn/prefer-set-size': 'off',
'unicorn/prefer-spread': 'off',
'unicorn/prefer-string-raw': 'off',
'unicorn/prefer-string-replace-all': 'off',
'unicorn/prefer-string-slice': 'off',
Expand Down
Loading