diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000..09dcf1c1 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,7 @@ +{ + "trailingComma": "all", + "tabWidth": 2, + "semi": true, + "singleQuote": true, + "printWidth": 100 +} diff --git a/package.json b/package.json index bb1148be..2337d980 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "bin": "./src/cli/index.js", "scripts": { "dev": "TS_NODE_FILES=true NODE_ENV=development ts-node ./src/cli", + "prod": "TS_NODE_FILES=true NODE_ENV=production ts-node ./src/cli prod", "build": "rm -rf dist && tsc && copyfiles --up 1 \"src/**/*.hbs\" dist/src/ && copyfiles \"README.*\" dist/ && copyfiles \"CHANGELOG.*\" dist/", "test": "jest --testPathIgnorePatterns 'tests/e2e/.*' 'example' --coverage", "e2e": "make e2e", diff --git a/src/generators/javascript/javascript.ts b/src/generators/javascript/javascript.ts index bae6270b..24f1733a 100644 --- a/src/generators/javascript/javascript.ts +++ b/src/generators/javascript/javascript.ts @@ -172,7 +172,7 @@ export const javascript: Generator< const formattedContents = prettier.format(contents, { parser: client.options.client.language === Language.TYPESCRIPT ? 'typescript' : 'babel', // Overwrite a few of the standard prettier settings to match with our RudderTyper configuration: - useTabs: true, + tabWidth: 2, singleQuote: true, semi: false, trailingComma: diff --git a/src/generators/javascript/templates/index.hbs b/src/generators/javascript/templates/index.hbs index 67a8be8d..f573874c 100644 --- a/src/generators/javascript/templates/index.hbs +++ b/src/generators/javascript/templates/index.hbs @@ -49,6 +49,7 @@ export type ViolationHandler = ( violations: {{#if isDevelopment}}ErrorObject{{else}}any{{/if}}[] ) => void +{{#if isDevelopment}} /** * The default handler that is fired if none is supplied with setRudderTyperOptions. {{#if isBrowser}} @@ -58,7 +59,6 @@ export type ViolationHandler = ( * a warning message to the console. {{/if}} */ -{{#if isDevelopment}} export const defaultValidationErrorHandler: ViolationHandler = (message, violations) => { const msg = JSON.stringify({ type: 'RudderTyper JSON Schema Validation Error',