-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: support
eslint@9
and flat config
- Loading branch information
1 parent
799968c
commit 492b253
Showing
20 changed files
with
507 additions
and
725 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
File renamed without changes.
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
36 changes: 36 additions & 0 deletions
36
packages/eslint-remote-tester/eslint-remote-tester.config.ts
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,36 @@ | ||
import js from '@eslint/js'; | ||
import type { Config } from './src/types'; | ||
|
||
export default defineConfig({ | ||
repositories: [ | ||
'AriPerkkio/eslint-remote-tester-integration-test-target', | ||
'AriPerkkio/aria-live-capture', | ||
'AriPerkkio/extend-to-be-announced', | ||
'AriPerkkio/state-mgmt-examples', | ||
'AriPerkkio/suspense-examples', | ||
], | ||
|
||
extensions: ['js', 'jsx', 'ts', 'tsx'], | ||
|
||
maxFileSizeBytes: undefined, | ||
|
||
rulesUnderTesting: [], | ||
|
||
resultParser: undefined, | ||
|
||
concurrentTasks: 3, | ||
|
||
eslintConfig: [js.configs.recommended] as any, | ||
|
||
cache: true, | ||
|
||
compare: false, | ||
|
||
updateComparisonReference: true, | ||
|
||
onComplete: undefined, | ||
}); | ||
|
||
function defineConfig(config: Config) { | ||
return config; | ||
} |
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
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,42 +1,16 @@ | ||
import { createRequire } from 'node:module'; | ||
import type { Service, RegisterOptions } from 'ts-node'; | ||
|
||
let registerer: Service | null = null; | ||
const require = createRequire(import.meta.url); | ||
|
||
/* istanbul ignore next */ | ||
const interopRequireDefault = (obj: any): { default: any } => | ||
obj && obj.__esModule ? obj : { default: obj }; | ||
|
||
/** @internal */ | ||
export const loadTSConfig = (configPath: string) => { | ||
try { | ||
registerer ||= require('ts-node').register({ | ||
moduleTypes: { '**/*.ts': 'cjs' }, | ||
} satisfies RegisterOptions) as Service; | ||
} catch (e: any) { | ||
if (e.code === 'MODULE_NOT_FOUND') { | ||
throw new Error( | ||
`'ts-node' is required for TypeScript configuration files. Make sure it is installed\nError: ${e.message}` | ||
); | ||
} | ||
|
||
throw e; | ||
} | ||
|
||
registerer.enabled(true); | ||
|
||
const configObject = interopRequireDefault(require(configPath)).default; | ||
|
||
registerer.enabled(false); | ||
export const loadTSConfig = async (configPath: string) => { | ||
const importx = await import('importx'); | ||
const config = await importx.import(configPath, import.meta.url); | ||
|
||
return configObject; | ||
return config.default; | ||
}; | ||
|
||
export const loadConfig = (configPath: string) => { | ||
export const loadConfig = async (configPath: string) => { | ||
if (configPath.endsWith('.ts')) { | ||
return loadTSConfig(configPath); | ||
} | ||
|
||
return require(configPath); | ||
const { default: config } = await import(configPath); | ||
return config; | ||
}; |
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
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
20 changes: 0 additions & 20 deletions
20
packages/eslint-remote-tester/test/integration/base.config.cjs
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
packages/eslint-remote-tester/test/integration/base.config.js
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 @@ | ||
/** @type {import('../../src/config/types').Config} */ | ||
const config = { | ||
repositories: ['AriPerkkio/eslint-remote-tester-integration-test-target'], | ||
extensions: ['.js'], | ||
pathIgnorePattern: '(expected-to-be-excluded)', | ||
rulesUnderTesting: [ | ||
'no-unreachable', | ||
'no-undef', | ||
'no-empty', | ||
'getter-return', | ||
'no-compare-neg-zero', | ||
], | ||
eslintConfig: `async function initialize() { | ||
const { default: js } = await import('@eslint/js'); | ||
const { FlatCompat } = await import('@eslint/eslintrc'); | ||
const compat = new FlatCompat({ baseDirectory: process.cwd() }); | ||
return [ | ||
js.configs.recommended, | ||
...compat.plugins('eslint-plugin-local-rules'), | ||
{ rules: { 'local-rules/some-unstable-rule': 'error' } }, | ||
]; | ||
}`, | ||
}; | ||
|
||
export default config; |
Oops, something went wrong.