|
1 | 1 | import { resolve } from "node:path"; |
2 | 2 |
|
3 | | -import { getReactEslintConfig } from "@speakeasy-api/shared"; |
4 | 3 | import { getDirname } from "cross-dirname"; |
5 | | -import globals from "globals"; |
| 4 | + |
| 5 | +import { getNodeESLintConfig } from "./index.mjs"; |
6 | 6 |
|
7 | 7 | const gitignorePath = resolve(getDirname(), "..", "..", ".gitignore"); |
8 | 8 |
|
9 | 9 | export default [ |
10 | | - ...getReactEslintConfig({ |
| 10 | + ...getNodeESLintConfig({ |
11 | 11 | gitignorePaths: gitignorePath, |
12 | 12 | rootDir: getDirname(), |
13 | 13 | entryPoints: { |
14 | 14 | "eslint.config.mjs": ["default"], |
| 15 | + "index.mjs": /.*/, |
15 | 16 | "types/index.ts": /.*/, |
16 | 17 | }, |
17 | | - // Since we're a mix of running in both Node.js and React, we override the |
18 | | - // globals set by the React config to include Node.js globals as well. |
19 | | - { |
20 | | - languageOptions: { |
21 | | - globals: { ...globals.browser, ...globals.node }, |
22 | | - }, |
23 | | - }, |
24 | | - // Disable unused exports rule for Storybook files |
25 | | - { |
26 | | - files: ["**/*.stories.{ts,tsx}", ".storybook/*.{ts,tsx}"], |
27 | | - rules: { |
28 | | - "fast-import/no-unused-exports": "off", |
29 | | - }, |
30 | | - }, |
31 | | - // Disallow console calls in compiler code (use logging.ts functions instead) |
32 | | - { |
33 | | - files: ["src/compiler/**/*.{ts,js,mts,mjs}"], |
34 | | - ignores: ["src/compiler/logging.ts"], |
35 | | - rules: { |
36 | | - "no-console": "error", |
37 | | - }, |
38 | | - }, |
| 18 | + ignores: ["src/compiler/data/wasm_exec.js"], |
| 19 | + restrictedImports: [ |
| 20 | + { |
| 21 | + type: "third-party", |
| 22 | + moduleSpecifier: "node:fs", |
| 23 | + allowed: [/src\/compiler\/cli\//], |
| 24 | + message: |
| 25 | + "File system access is only allowed in the CLI wrapper because other code needs to be isomorphic", |
| 26 | + }, |
| 27 | + ], |
| 28 | + }), |
39 | 29 | ]; |
0 commit comments