diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-01-09 20:33:53 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2022-01-09 20:33:53 +0100 |
commit | d85f09cbed5f3d2501f791e689011ae127df1cbb (patch) | |
tree | 0ed5be55dd5d3dec1d51eb60e7ff229274030a57 /config | |
parent | build: Disable single-run eslint-typescript (diff) | |
download | sophie-d85f09cbed5f3d2501f791e689011ae127df1cbb.tar.gz sophie-d85f09cbed5f3d2501f791e689011ae127df1cbb.tar.zst sophie-d85f09cbed5f3d2501f791e689011ae127df1cbb.zip |
build: Add prettier
eslint will also enforce prettier rules, so there is no need to call
prettier separately in CI.
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'config')
-rw-r--r-- | config/buildConstants.js | 8 | ||||
-rw-r--r-- | config/getEsbuildConfig.js | 2 | ||||
-rw-r--r-- | config/jest.config.base.js | 20 | ||||
-rw-r--r-- | config/tsconfig.base.json | 4 |
4 files changed, 18 insertions, 16 deletions
diff --git a/config/buildConstants.js b/config/buildConstants.js index 9083d78..3c55500 100644 --- a/config/buildConstants.js +++ b/config/buildConstants.js | |||
@@ -7,11 +7,15 @@ const thisDir = fileURLToDirname(import.meta.url); | |||
7 | 7 | ||
8 | // We import this from a vite config, where top-level await is not available (es2021), | 8 | // We import this from a vite config, where top-level await is not available (es2021), |
9 | // so we have to use the synchronous filesystem API. | 9 | // so we have to use the synchronous filesystem API. |
10 | const electronVendorsJson = readFileSync(join(thisDir, '../.electron-vendors.cache.json'), 'utf8'); | 10 | const electronVendorsJson = readFileSync( |
11 | join(thisDir, '../.electron-vendors.cache.json'), | ||
12 | 'utf8', | ||
13 | ); | ||
11 | 14 | ||
12 | /** @type {{ chrome: number; node: number; }} */ | 15 | /** @type {{ chrome: number; node: number; }} */ |
13 | // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | 16 | // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment |
14 | const { chrome: chromeVersion, node: nodeVersion } = JSON.parse(electronVendorsJson); | 17 | const { chrome: chromeVersion, node: nodeVersion } = |
18 | JSON.parse(electronVendorsJson); | ||
15 | 19 | ||
16 | /** @type {string} */ | 20 | /** @type {string} */ |
17 | export const banner = `/*! | 21 | export const banner = `/*! |
diff --git a/config/getEsbuildConfig.js b/config/getEsbuildConfig.js index b338d68..930f19f 100644 --- a/config/getEsbuildConfig.js +++ b/config/getEsbuildConfig.js | |||
@@ -25,7 +25,7 @@ export default function getEsbuildConfig(config, extraMetaEnvVars) { | |||
25 | js: banner, | 25 | js: banner, |
26 | }, | 26 | }, |
27 | ...config, | 27 | ...config, |
28 | sourcemap: isDevelopment ? (config.sourcemap || true) : false, | 28 | sourcemap: isDevelopment ? config.sourcemap || true : false, |
29 | define: { | 29 | define: { |
30 | 'process.env.NODE_ENV': modeString, | 30 | 'process.env.NODE_ENV': modeString, |
31 | 'process.env.MODE': modeString, | 31 | 'process.env.MODE': modeString, |
diff --git a/config/jest.config.base.js b/config/jest.config.base.js index 463e498..21f93be 100644 --- a/config/jest.config.base.js +++ b/config/jest.config.base.js | |||
@@ -9,22 +9,22 @@ export default { | |||
9 | transform: { | 9 | transform: { |
10 | '\\.tsx?$': join(thisDir, 'jestEsbuildTransformer.js'), | 10 | '\\.tsx?$': join(thisDir, 'jestEsbuildTransformer.js'), |
11 | }, | 11 | }, |
12 | extensionsToTreatAsEsm: [ | 12 | extensionsToTreatAsEsm: ['.ts', '.tsx'], |
13 | '.ts', | ||
14 | '.tsx', | ||
15 | ], | ||
16 | moduleNameMapper: { | 13 | moduleNameMapper: { |
17 | '^@sophie/(.+)$': join(thisDir, '../packages/$1/src/index.ts'), | 14 | '^@sophie/(.+)$': join(thisDir, '../packages/$1/src/index.ts'), |
18 | '^(\\.{1,2}/.*)\\.jsx?$': '$1', | 15 | '^(\\.{1,2}/.*)\\.jsx?$': '$1', |
19 | // Workaround for jest to recognize the vendored dependencies of chalk. | 16 | // Workaround for jest to recognize the vendored dependencies of chalk. |
20 | '^#ansi-styles$': join(thisDir, '../node_modules/chalk/source/vendor/ansi-styles/index.js'), | 17 | '^#ansi-styles$': join( |
21 | '^#supports-color$': join(thisDir, '../node_modules/chalk/source/vendor/supports-color/index.js'), | 18 | thisDir, |
19 | '../node_modules/chalk/source/vendor/ansi-styles/index.js', | ||
20 | ), | ||
21 | '^#supports-color$': join( | ||
22 | thisDir, | ||
23 | '../node_modules/chalk/source/vendor/supports-color/index.js', | ||
24 | ), | ||
22 | }, | 25 | }, |
23 | resetMocks: true, | 26 | resetMocks: true, |
24 | restoreMocks: true, | 27 | restoreMocks: true, |
25 | testEnvironment: 'node', | 28 | testEnvironment: 'node', |
26 | testPathIgnorePatterns: [ | 29 | testPathIgnorePatterns: ['/dist/', '/node_modules/'], |
27 | '/dist/', | ||
28 | '/node_modules/', | ||
29 | ], | ||
30 | }; | 30 | }; |
diff --git a/config/tsconfig.base.json b/config/tsconfig.base.json index 255f334..ff7594e 100644 --- a/config/tsconfig.base.json +++ b/config/tsconfig.base.json | |||
@@ -12,8 +12,6 @@ | |||
12 | "isolatedModules": true, | 12 | "isolatedModules": true, |
13 | "skipLibCheck": true, | 13 | "skipLibCheck": true, |
14 | "checkJs": true, | 14 | "checkJs": true, |
15 | "lib": [ | 15 | "lib": ["esnext"] |
16 | "esnext" | ||
17 | ] | ||
18 | } | 16 | } |
19 | } | 17 | } |