Skip to content

Commit b84fdfa

Browse files
committed
build(eslint-plugin-react-hooks): remove tsup
This change removes tsup from the devloop of `eslint-plugin-react-hooks`. I was originally using it to quickly run tests and builds as I was doing the migration, but now that we've added support to the larger rollup build process, there's no longer a need for it. I've added an index.js to the root of the package folder that's just a proxy for the `src/index.ts`. It uses tsx to load it for other consumers in the monorepo (e.g. the eventual e2e tests fixtures). For jest, the index.js is able to load the ts file due to the added configuration in the package's babel and jest configs. This `index.js` will only be used for dev purposes. The `index.js` that's in the `npm` folder is what will actually make it into the published package.
1 parent 75e6f7d commit b84fdfa

File tree

9 files changed

+11
-510
lines changed

9 files changed

+11
-510
lines changed

packages/eslint-plugin-react-hooks/babel.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,5 @@
44
'use strict';
55

66
module.exports = {
7-
plugins: [
8-
'@babel/plugin-syntax-jsx',
9-
'@babel/plugin-transform-flow-strip-types',
10-
],
7+
extends: '../../babel.config-ts.js',
118
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require('./build/index.js');
1+
module.exports = require('./src/index.ts');

packages/eslint-plugin-react-hooks/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ process.env.NODE_ENV = 'development';
44

55
module.exports = {
66
setupFiles: [require.resolve('../../scripts/jest/setupEnvironment.js')],
7+
moduleFileExtensions: ['ts', 'js', 'json'],
78
};

packages/eslint-plugin-react-hooks/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
"react"
2222
],
2323
"scripts": {
24-
"build": "tsup",
25-
"test": "tsup && jest",
24+
"test": "jest",
2625
"typecheck": "tsc --noEmit"
2726
},
2827
"license": "MIT",
@@ -40,6 +39,7 @@
4039
},
4140
"devDependencies": {
4241
"@babel/eslint-parser": "^7.11.4",
42+
"@babel/preset-typescript": "^7.26.0",
4343
"@tsconfig/strictest": "^2.0.5",
4444
"@typescript-eslint/parser-v2": "npm:@typescript-eslint/parser@^2.26.0",
4545
"@typescript-eslint/parser-v3": "npm:@typescript-eslint/parser@^3.10.0",
@@ -53,7 +53,6 @@
5353
"eslint-v7": "npm:eslint@^7.7.0",
5454
"eslint-v9": "npm:eslint@^9.0.0",
5555
"jest": "^29.5.0",
56-
"tsup": "^8.3.5",
5756
"typescript": "^5.4.3"
5857
}
5958
}

packages/eslint-plugin-react-hooks/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"moduleResolution": "Bundler",
77
"lib": ["ES2020"],
88
"rootDir": ".",
9-
"noEmit": true,
109
"sourceMap": false,
1110
"types": ["estree-jsx", "node"]
1211
},

packages/eslint-plugin-react-hooks/tsup.config.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/shared/ReactVersion.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1 @@
1-
/**
2-
* Copyright (c) Meta Platforms, Inc. and affiliates.
3-
*
4-
* This source code is licensed under the MIT license found in the
5-
* LICENSE file in the root directory of this source tree.
6-
*/
7-
8-
// TODO: this is special because it gets imported during build.
9-
//
10-
// It exists as a placeholder so that DevTools can support work tag changes between releases.
11-
// When we next publish a release, update the matching TODO in backend/renderer.js
12-
// TODO: This module is used both by the release scripts and to expose a version
13-
// at runtime. We should instead inject the version number as part of the build
14-
// process, and use the ReactVersions.js module as the single source of truth.
15-
export default '19.1.0';
1+
export default '19.1.0-canary-12e3539b-20250216';

scripts/jest/setupGlobal.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11
/* eslint-disable */
22

3-
const {join} = require('path');
4-
const {exec} = require('child-process-promise');
5-
6-
module.exports = async () => {
3+
module.exports = () => {
74
// can use beforeEach/afterEach or setupEnvironment.js in node >= 13: https://github.com/nodejs/node/pull/20026
85
// jest's `setupFiles` is too late: https://stackoverflow.com/a/56482581/3406963
96
process.env.TZ = 'UTC';
10-
11-
const cwd = join(
12-
__dirname,
13-
'..',
14-
'..',
15-
'packages',
16-
'eslint-plugin-react-hooks'
17-
);
18-
// Run TypeScript on eslint-plugin-react-hooks prior to tests
19-
return await exec('yarn build', {cwd});
207
};

yarn.lock

Lines changed: 4 additions & 463 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)