Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(experimental-utils): console.warn on import of experimental-utils #6179

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/experimental-utils/package.json
Expand Up @@ -35,6 +35,7 @@
"postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage",
"format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore",
"lint": "nx lint",
"test": "jest",
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
Expand Down
8 changes: 7 additions & 1 deletion packages/experimental-utils/src/index.ts
@@ -1,2 +1,8 @@
// TODO (#4139): Once typescript-eslint hits v7, this package will console.warn to switch...
/* eslint-disable no-console */
console.warn(
'This package is purely a re-export of `@typescript-eslint/utils`.',
);
console.warn(
'You should switch to importing from that non-experimental package instead.',
);
export * from '@typescript-eslint/utils';
10 changes: 10 additions & 0 deletions packages/experimental-utils/tests/consoleWarning.test.ts
@@ -0,0 +1,10 @@
describe('importing', () => {
it('should console a warning', () => {
const warn = jest.spyOn(console, 'warn').mockImplementation(() => {});
require('../src/index');
expect(warn).toHaveBeenCalledTimes(2);
expect(warn).toHaveBeenLastCalledWith(
'You should switch to importing from that non-experimental package instead.',
);
});
});