Skip to content

Commit

Permalink
chore: fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed Mar 2, 2023
1 parent ff680bb commit f98afd2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
13 changes: 13 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,19 @@ module.exports = {
'@typescript-eslint/sort-type-constituents': 'error',
},
},
{
files: ['./packages/ast-spec/**/*.ts'],
rules: {
'no-restricted-imports': [
'error',
{
name: '@typescript-eslint/typescript-estree',
message:
'To prevent nx build errors, all `typescript-estree` imports should be done via `packages/ast-spec/tests/util/parsers/typescript-estree-import.ts`.',
},
],
},
},
{
files: ['rollup.config.ts'],
rules: {
Expand Down
2 changes: 1 addition & 1 deletion packages/ast-spec/tests/fixtures.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import type {
} from './util/parsers/parser-types';
import { ParserResponseType } from './util/parsers/parser-types';
import { parseTSESTree } from './util/parsers/typescript-estree';
import { diffHasChanges, snapshotDiff } from './util/snapshot-diff';
import { serializeError } from './util/serialize-error';
import { diffHasChanges, snapshotDiff } from './util/snapshot-diff';

const PACKAGE_ROOT = path.resolve(__dirname, '..');
const SRC_DIR = path.resolve(PACKAGE_ROOT, 'src');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
* This should be the only place in the package that we import from typescript-estree.
*/

export { parse } from '@typescript-eslint/typescript-estree';
// eslint-disable-next-line no-restricted-imports -- the only safe and valid import from typescript-estree in this package
export { parse, TSError } from '@typescript-eslint/typescript-estree';
3 changes: 2 additions & 1 deletion packages/ast-spec/tests/util/serialize-error.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { codeFrameColumns } from '@babel/code-frame';
import { TSError } from '@typescript-eslint/typescript-estree';

import { TSError } from './parsers/typescript-estree-import';

export function serializeError(
error: unknown,
Expand Down

0 comments on commit f98afd2

Please sign in to comment.