Skip to content

Commit a794914

Browse files
committed
test: add v9 example for integration testing
1 parent 6d576f3 commit a794914

File tree

11 files changed

+106
-2
lines changed

11 files changed

+106
-2
lines changed

examples/flat/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"version": "1.0.0",
44
"main": "index.js",
55
"scripts": {
6-
"lint": "cross-env ESLINT_USE_FLAT_CONFIG=true eslint src --report-unused-disable-directives"
6+
"prelint": "move-file ../../.eslintrc ../../.no-config-here",
7+
"lint": "cross-env ESLINT_USE_FLAT_CONFIG=true eslint src --report-unused-disable-directives",
8+
"postlint": "move-file ../../.no-config-here ../../.eslintrc"
79
},
810
"devDependencies": {
911
"@eslint/js": "^9.5.0",
@@ -12,6 +14,7 @@
1214
"cross-env": "^7.0.3",
1315
"eslint": "^8.57.0",
1416
"eslint-plugin-import": "file:../..",
17+
"move-file-cli": "^3.0.0",
1518
"typescript": "^5.4.5"
1619
}
1720
}

examples/v9/eslint.config.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import importPlugin from 'eslint-plugin-import';
2+
import js from '@eslint/js';
3+
import tsParser from '@typescript-eslint/parser';
4+
5+
export default [
6+
js.configs.recommended,
7+
importPlugin.flatConfigs.recommended,
8+
importPlugin.flatConfigs.react,
9+
importPlugin.flatConfigs.typescript,
10+
{
11+
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
12+
languageOptions: {
13+
parser: tsParser,
14+
ecmaVersion: 'latest',
15+
sourceType: 'module',
16+
},
17+
ignores: ['eslint.config.mjs', '**/exports-unused.ts'],
18+
rules: {
19+
'no-unused-vars': 'off',
20+
'import/no-dynamic-require': 'warn',
21+
'import/no-nodejs-modules': 'warn',
22+
'import/no-unused-modules': ['warn', { unusedExports: true }],
23+
'import/no-cycle': 'warn',
24+
},
25+
},
26+
];

examples/v9/package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "v9",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"scripts": {
6+
"prelint": "move-file ../../.eslintrc ../../.no-config-here",
7+
"lint": "eslint src --report-unused-disable-directives",
8+
"postlint": "move-file ../../.no-config-here ../../.eslintrc"
9+
},
10+
"devDependencies": {
11+
"@eslint/js": "^9.17.0",
12+
"@types/node": "^20.14.5",
13+
"@typescript-eslint/parser": "^8.18.0",
14+
"cross-env": "^7.0.3",
15+
"eslint": "^9.17.0",
16+
"eslint-plugin-import": "file:../..",
17+
"move-file-cli": "^3.0.0",
18+
"typescript": "^5.4.5"
19+
}
20+
}

examples/v9/src/depth-zero.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { foo } from "./es6/depth-one-dynamic";
2+
3+
foo();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function foo() {}
2+
3+
export const bar = () => import("../depth-zero").then(({foo}) => foo);

examples/v9/src/exports-unused.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export type ScalarType = string | number;
2+
export type ObjType = {
3+
a: ScalarType;
4+
b: ScalarType;
5+
};
6+
7+
export const a = 13;
8+
export const b = 18;
9+
10+
const defaultExport: ObjType = { a, b };
11+
12+
export default defaultExport;

examples/v9/src/exports.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export type ScalarType = string | number;
2+
export type ObjType = {
3+
a: ScalarType;
4+
b: ScalarType;
5+
};
6+
7+
export const a = 13;
8+
export const b = 18;
9+
10+
const defaultExport: ObjType = { a, b };
11+
12+
export default defaultExport;

examples/v9/src/imports.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//import c from './exports';
2+
import { a, b } from './exports';
3+
import type { ScalarType, ObjType } from './exports';
4+
5+
import path from 'path';
6+
import fs from 'node:fs';
7+
import console from 'console';

examples/v9/src/jsx.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const Components = () => {
2+
return <></>;
3+
};

examples/v9/tsconfig.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"compilerOptions": {
3+
"jsx": "react-jsx",
4+
"lib": ["ESNext"],
5+
"target": "ESNext",
6+
"module": "ESNext",
7+
"rootDir": "./",
8+
"moduleResolution": "Bundler",
9+
"esModuleInterop": true,
10+
"forceConsistentCasingInFileNames": true,
11+
"strict": true,
12+
"skipLibCheck": true
13+
}
14+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@
3333
"test": "npm run tests-only",
3434
"test-compiled": "npm run prepublish && BABEL_ENV=testCompiled mocha --compilers js:babel-register tests/src",
3535
"test-all": "node --require babel-register ./scripts/testAll",
36-
"test-examples": "npm run build && npm run test-example:legacy && npm run test-example:flat",
36+
"test-examples": "npm run build && npm run test-example:legacy && npm run test-example:flat && npm run test-example:v9",
3737
"test-example:legacy": "cd examples/legacy && npm install && npm run lint",
3838
"test-example:flat": "cd examples/flat && npm install && npm run lint",
39+
"test-example:v9": "cd examples/v9 && npm install && npm run lint",
3940
"test-types": "npx --package typescript@latest tsc --noEmit index.d.ts",
4041
"prepublishOnly": "safe-publish-latest && npm run build",
4142
"prepublish": "not-in-publish || npm run prepublishOnly",

0 commit comments

Comments
 (0)