Skip to content

Commit

Permalink
fix(typescript): Use consistent typescript configs
Browse files Browse the repository at this point in the history
make all packages inherit tsconfig from the root tsconfig
  • Loading branch information
netroy committed Sep 9, 2022
1 parent d0c9120 commit cbfbde2
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 184 deletions.
4 changes: 2 additions & 2 deletions docker/images/n8n-custom/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN \
apk --no-cache add git && \
npm install -g run-script-os turbo

COPY turbo.json package.json package-lock.json ./
COPY turbo.json package.json package-lock.json tsconfig.json ./
COPY packages ./packages

RUN chown -R node:node .
Expand All @@ -21,7 +21,7 @@ RUN \
# TODO: removing dev dependecies is deleting `bn.js`, which breaks the Snowflake node
npm prune --omit=dev && \
npm i --omit=dev bn.js && \
find . -type f -name "*.ts" -o -name "*.js.map" -o -name "*.vue" | xargs rm &&\
find . -type f -name "*.ts" -o -name "*.js.map" -o -name "*.vue" -o -name "tsconfig.json" | xargs rm &&\
rm -rf node_modules/.cache packages/*/node_modules/.cache packages/*/.turbo .config .npm /tmp/*


Expand Down
2 changes: 1 addition & 1 deletion packages/cli/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
verbose: true,
transform: {
'^.+\\.ts?$': 'ts-jest',
'^.+\\.ts$': 'ts-jest',
},
testURL: 'http://localhost/',
testRegex: '(/__tests__/.*|(\\.|/)(test))\\.ts$',
Expand Down
27 changes: 6 additions & 21 deletions packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": [
"es2017",
"ES2020.Promise"
],
"outDir": "dist",
"types": [
"node",
"jest"
],
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"strictNullChecks": true,
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"preserveConstEnums": true,
"declaration": true,
"outDir": "./dist/",
"target": "es2017",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"esModuleInterop": true
// TODO: remove all options below this line
"strict": false,
"noUnusedLocals": false,
"useUnknownInCatchVariables": false,
},
"include": [
"**/*.d.ts",
Expand All @@ -30,10 +20,5 @@
"config/**/*",
"src/**/*",
"test/**/*"
],
"exclude": [
"dist/**/*",
"node_modules/**/*",
"**/*.spec.ts"
]
}
5 changes: 2 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,16 @@
},
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest"
"^.+\\.ts$": "ts-jest"
},
"testURL": "http://localhost/",
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(js|ts)$",
"testPathIgnorePatterns": [
"/dist/",
"/node_modules/"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"json",
"node"
Expand Down
23 changes: 3 additions & 20 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": [
"es2019"
],
"outDir": "dist",
"types": [
"node",
"jest"
],
"module": "commonjs",
"removeComments": true,
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"strict": true,
"noUnusedLocals": true,
"preserveConstEnums": true,
"declaration": true,
"outDir": "./dist/",
"target": "es2019",
"sourceMap": true,
"esModuleInterop": true,
// TODO: remove all options below this line
"useUnknownInCatchVariables": false,
},
"include": [
"**/*.d.ts",
"src/**/*",
"test/**/*"
],
"exclude": [
"dist/**/*",
"node_modules/**/*",
"**/*.spec.ts"
]
}
2 changes: 1 addition & 1 deletion packages/design-system/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const path = require('path');
* @type {import('@storybook/core-common').StorybookConfig}
*/
module.exports = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|ts)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
Expand Down
13 changes: 0 additions & 13 deletions packages/design-system/src/shims-tsx.d.ts

This file was deleted.

39 changes: 21 additions & 18 deletions packages/design-system/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"target": "esnext",
"module": "esnext",
"strict": true,
"importHelpers": true,
"moduleResolution": "node",
"declaration": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowJs": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"outDir": "dist",
"types": [
"webpack-env",
"jest",
"vitest/globals"
"webpack-env",
"jest",
"vitest/globals"
],
"typeRoots": [
"@testing-library",
"@types"
"typeRoots": [
"@testing-library",
"@types"
],
"paths": {
"@/*": ["src/*"]
"@/*": [
"src/*"
]
},
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
],
// TODO: remove all options below this line
"noUnusedLocals": false,
"noImplicitReturns": false,
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue"
],
"exclude": ["node_modules"]
]
}
6 changes: 2 additions & 4 deletions packages/editor-ui/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
module.exports = {
moduleFileExtensions: [
'js',
'jsx',
'json',
'vue',
'ts',
'tsx',
],
transform: {
'^.+\\.vue$': 'vue-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.ts$': 'ts-jest',
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
Expand All @@ -19,7 +17,7 @@ module.exports = {
'jest-serializer-vue',
],
testMatch: [
'**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)',
'**/tests/unit/**/*.spec.(js|ts)|**/__tests__/*.(js|ts)',
],
testURL: 'http://localhost/',
};
13 changes: 0 additions & 13 deletions packages/editor-ui/src/shims-tsx.d.ts

This file was deleted.

22 changes: 6 additions & 16 deletions packages/editor-ui/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"removeComments": true,
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"strict": true,
"jsx": "preserve",
"skipLibCheck": true,
"allowJs": true,
"importHelpers": true,
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"useUnknownInCatchVariables": false,
"resolveJsonModule": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env",
Expand All @@ -30,16 +22,14 @@
"dom",
"dom.iterable",
"scripthost"
]
],
// TODO: remove all options below this line
"noUnusedLocals": false,
"useUnknownInCatchVariables": false,
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx",
],
"exclude": [
"node_modules"
]
}
13 changes: 1 addition & 12 deletions packages/node-dev/src/tsconfig-build.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": [
"es2017"
],
"types": [],
"module": "commonjs",
"importHelpers": true,
"preserveConstEnums": true,
"declaration": true,
"target": "es2017",
"sourceMap": true
},
"include": [
"*.credentials.ts",
"*.node.ts"
],
"exclude": [
"node_modules"
]
}
22 changes: 4 additions & 18 deletions packages/node-dev/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": [
"es2019"
],
"outDir": "dist",
"types": [
"node"
],
"module": "commonjs",
"esModuleInterop": true,
"removeComments": true,
"strict": true,
"preserveConstEnums": true,
"declaration": true,
"outDir": "./dist/",
"target": "es2019",
"useUnknownInCatchVariables": false,
"sourceMap": true
// TODO: remove all options below this line
"noUnusedLocals": false,
},
"include": [
"**/*.d.ts",
"commands/**/*",
"index.ts",
"src/**/*"
],
"exclude": [
"dist",
"node_modules/**/*",
"**/*.spec.ts"
]
}
5 changes: 2 additions & 3 deletions packages/nodes-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -795,17 +795,16 @@
},
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest"
"^.+\\.ts$": "ts-jest"
},
"testURL": "http://localhost/",
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(js|ts)$",
"testPathIgnorePatterns": [
"/dist/",
"/node_modules/"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"json"
]
Expand Down
Loading

0 comments on commit cbfbde2

Please sign in to comment.