Skip to content

Commit

Permalink
build(eslint-plugin-react-hooks): remove tsup
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michaelfaith committed Feb 16, 2025
1 parent ad617f9 commit bddfebf
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 495 deletions.
5 changes: 1 addition & 4 deletions packages/eslint-plugin-react-hooks/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
'use strict';

module.exports = {
plugins: [
'@babel/plugin-syntax-jsx',
'@babel/plugin-transform-flow-strip-types',
],
extends: '../../babel.config-ts.js',
};
2 changes: 1 addition & 1 deletion packages/eslint-plugin-react-hooks/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./build/index.js');
module.exports = require('./src/index.ts');
1 change: 1 addition & 0 deletions packages/eslint-plugin-react-hooks/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ process.env.NODE_ENV = 'development';

module.exports = {
setupFiles: [require.resolve('../../scripts/jest/setupEnvironment.js')],
moduleFileExtensions: ['ts', 'js', 'json'],
};
5 changes: 2 additions & 3 deletions packages/eslint-plugin-react-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"react"
],
"scripts": {
"build": "tsup",
"test": "tsup && jest",
"test": "jest",
"typecheck": "tsc --noEmit"
},
"license": "MIT",
Expand All @@ -40,6 +39,7 @@
},
"devDependencies": {
"@babel/eslint-parser": "^7.11.4",
"@babel/preset-typescript": "^7.26.0",
"@tsconfig/strictest": "^2.0.5",
"@typescript-eslint/parser-v2": "npm:@typescript-eslint/parser@^2.26.0",
"@typescript-eslint/parser-v3": "npm:@typescript-eslint/parser@^3.10.0",
Expand All @@ -53,7 +53,6 @@
"eslint-v7": "npm:eslint@^7.7.0",
"eslint-v9": "npm:eslint@^9.0.0",
"jest": "^29.5.0",
"tsup": "^8.3.5",
"typescript": "^5.4.3"
}
}
1 change: 0 additions & 1 deletion packages/eslint-plugin-react-hooks/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"moduleResolution": "Bundler",
"lib": ["ES2020"],
"rootDir": ".",
"noEmit": true,
"sourceMap": false,
"types": ["estree-jsx", "node"]
},
Expand Down
9 changes: 0 additions & 9 deletions packages/eslint-plugin-react-hooks/tsup.config.ts

This file was deleted.

15 changes: 1 addition & 14 deletions scripts/jest/setupGlobal.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
/* eslint-disable */

const {join} = require('path');
const {exec} = require('child-process-promise');

module.exports = async () => {
module.exports = () => {
// can use beforeEach/afterEach or setupEnvironment.js in node >= 13: https://github.com/nodejs/node/pull/20026
// jest's `setupFiles` is too late: https://stackoverflow.com/a/56482581/3406963
process.env.TZ = 'UTC';

const cwd = join(
__dirname,
'..',
'..',
'packages',
'eslint-plugin-react-hooks'
);
// Run TypeScript on eslint-plugin-react-hooks prior to tests
return await exec('yarn build', {cwd});
};
467 changes: 4 additions & 463 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit bddfebf

Please sign in to comment.