Skip to content

Commit ad9b75a

Browse files
Copilothi-ogawa
andcommitted
Enable import sorting rules for plugin-rsc directory
Co-authored-by: hi-ogawa <[email protected]>
1 parent e9cd532 commit ad9b75a

File tree

19 files changed

+107
-33
lines changed

19 files changed

+107
-33
lines changed

eslint.config.js

Lines changed: 80 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@ import globals from 'globals'
99

1010
export default tseslint.config(
1111
{
12-
ignores: [
13-
'**/dist/**',
14-
'**/playground-temp/**',
15-
'**/temp/**',
16-
'packages/plugin-rsc/**',
17-
],
12+
ignores: ['**/dist/**', '**/playground-temp/**', '**/temp/**'],
1813
},
1914
eslint.configs.recommended,
2015
...tseslint.configs.recommended,
@@ -168,4 +163,83 @@ export default tseslint.config(
168163
'@typescript-eslint/triple-slash-reference': 'off',
169164
},
170165
},
166+
{
167+
name: 'plugin-rsc/import-sorting-only',
168+
files: ['packages/plugin-rsc/**/*.?([cm])[jt]s?(x)'],
169+
plugins: {
170+
'import-x': pluginImportX,
171+
},
172+
rules: {
173+
// Disable all existing rules from the main config
174+
eqeqeq: 'off',
175+
'no-debugger': 'off',
176+
'no-empty': 'off',
177+
'no-empty-pattern': 'off',
178+
'no-constant-condition': 'off',
179+
'no-extra-boolean-cast': 'off',
180+
'prefer-const': 'off',
181+
'prefer-spread': 'off',
182+
183+
// Disable Node.js plugin rules
184+
'n/no-process-exit': 'off',
185+
'n/no-deprecated-api': 'off',
186+
'n/no-unpublished-import': 'off',
187+
'n/no-unpublished-require': 'off',
188+
'n/no-unsupported-features/es-syntax': 'off',
189+
'n/no-unsupported-features/node-builtins': 'off',
190+
'n/no-unsupported-features/es-builtins': 'off',
191+
'n/no-missing-import': 'off',
192+
'n/no-missing-require': 'off',
193+
'n/no-extraneous-import': 'off',
194+
'n/no-extraneous-require': 'off',
195+
196+
// Disable TypeScript rules
197+
'@typescript-eslint/explicit-module-boundary-types': 'off',
198+
'@typescript-eslint/no-empty-function': 'off',
199+
'@typescript-eslint/no-empty-interface': 'off',
200+
'@typescript-eslint/no-explicit-any': 'off',
201+
'@typescript-eslint/no-extra-semi': 'off',
202+
'@typescript-eslint/no-inferrable-types': 'off',
203+
'@typescript-eslint/no-unused-vars': 'off',
204+
'@typescript-eslint/no-var-requires': 'off',
205+
'@typescript-eslint/consistent-type-imports': 'off',
206+
'@typescript-eslint/array-type': 'off',
207+
'@typescript-eslint/consistent-type-definitions': 'off',
208+
'@typescript-eslint/prefer-for-of': 'off',
209+
'@typescript-eslint/prefer-function-type': 'off',
210+
'@typescript-eslint/consistent-indexed-object-style': 'off',
211+
'@typescript-eslint/triple-slash-reference': 'off',
212+
'@typescript-eslint/ban-ts-comment': 'off',
213+
'@typescript-eslint/no-unused-expressions': 'off',
214+
'@typescript-eslint/no-unsafe-function-type': 'off',
215+
'@typescript-eslint/no-namespace': 'off',
216+
217+
// Disable regexp rules
218+
'regexp/prefer-regexp-exec': 'off',
219+
'regexp/prefer-regexp-test': 'off',
220+
'regexp/use-ignore-case': 'off',
221+
'regexp/no-super-linear-backtracking': 'off',
222+
'regexp/no-unused-capturing-group': 'off',
223+
224+
// Disable other import rules except the ones we want
225+
'import-x/no-nodejs-modules': 'off',
226+
227+
// Disable globals restriction
228+
'no-restricted-globals': 'off',
229+
230+
// Enable only import sorting related rules
231+
'import-x/no-duplicates': 'error',
232+
'import-x/order': 'error',
233+
'sort-imports': [
234+
'error',
235+
{
236+
ignoreCase: false,
237+
ignoreDeclarationSort: true,
238+
ignoreMemberSort: false,
239+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
240+
allowSeparatedGroups: false,
241+
},
242+
],
243+
},
244+
},
171245
)

packages/plugin-rsc/e2e/browser-mode.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect, test, type Page } from '@playwright/test'
1+
import { type Page, expect, test } from '@playwright/test'
22
import { useFixture } from './fixture'
33
import { defineStarterTest } from './starter'
44

packages/plugin-rsc/e2e/build-app.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { test, expect } from '@playwright/test'
2-
import { setupInlineFixture, useFixture } from './fixture'
1+
import { expect, test } from '@playwright/test'
32
import { x } from 'tinyexec'
3+
import { setupInlineFixture, useFixture } from './fixture'
44
import { waitForHydration } from './helper'
55

66
test.describe('buildApp hook', () => {

packages/plugin-rsc/e2e/isolated.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import path from 'node:path'
2+
import os from 'node:os'
13
import { test } from '@playwright/test'
24
import { setupIsolatedFixture, useFixture } from './fixture'
35
import { defineStarterTest } from './starter'
4-
import path from 'node:path'
5-
import os from 'node:os'
66

77
test.describe(() => {
88
// use RUNNER_TEMP on Github Actions

packages/plugin-rsc/e2e/no-ssr.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import path from 'node:path'
2+
import fs from 'node:fs'
13
import { expect, test } from '@playwright/test'
24
import { useFixture } from './fixture'
35
import { defineStarterTest } from './starter'
4-
import path from 'node:path'
5-
import fs from 'node:fs'
66

77
test.describe('dev-no-ssr', () => {
88
const f = useFixture({ root: 'examples/no-ssr', mode: 'dev' })

packages/plugin-rsc/e2e/react-router.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { createHash } from 'node:crypto'
2+
import { readFileSync } from 'node:fs'
23
import { expect, test } from '@playwright/test'
4+
import React from 'react'
35
import { type Fixture, useFixture } from './fixture'
46
import { expectNoReload, testNoJs, waitForHydration } from './helper'
5-
import { readFileSync } from 'node:fs'
6-
import React from 'react'
77

88
test.describe('dev-default', () => {
99
test.skip(/canary|experimental/.test(React.version))

packages/plugin-rsc/e2e/render-built-url.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import fs from 'node:fs'
12
import { expect, test } from '@playwright/test'
23
import { setupInlineFixture, useFixture } from './fixture'
34
import { defineStarterTest } from './starter'
45
import { expectNoPageError, waitForHydration } from './helper'
5-
import fs from 'node:fs'
66

77
test.describe(() => {
88
const root = 'examples/e2e/temp/renderBuiltUrl-runtime'

packages/plugin-rsc/e2e/ssr-thenable.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { test } from '@playwright/test'
2-
import { setupInlineFixture, type Fixture, useFixture } from './fixture'
2+
import { type Fixture, setupInlineFixture, useFixture } from './fixture'
33
import {
44
expectNoPageError,
55
waitForHydration as waitForHydration_,

packages/plugin-rsc/e2e/syntax-error.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { test, expect } from '@playwright/test'
1+
import { expect, test } from '@playwright/test'
22
import { setupInlineFixture, useFixture } from './fixture'
3-
import { waitForHydration, expectNoReload } from './helper'
3+
import { expectNoReload, waitForHydration } from './helper'
44

55
test.describe(() => {
66
const root = 'examples/e2e/temp/syntax-error'

packages/plugin-rsc/e2e/validate-imports.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { test, expect } from '@playwright/test'
2-
import { setupInlineFixture, useFixture, type Fixture } from './fixture'
1+
import { expect, test } from '@playwright/test'
32
import { x } from 'tinyexec'
3+
import { type Fixture, setupInlineFixture, useFixture } from './fixture'
44
import { expectNoPageError, waitForHydration } from './helper'
55

66
test.describe('validate imports', () => {

0 commit comments

Comments
 (0)