diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..8457c4d --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +.idea/ +dist/ +node_modules/ +coverage/ \ No newline at end of file diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..bb92948 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,19 @@ +module.exports = { + overrides: [ + { + files: '*.js', + options: { + tabWidth: 4, + singleQuote: true, + }, + }, + { + files: '*.ts', + options: { + tabWidth: 4, + singleQuote: true, + trailingComma: 'none', + }, + }, + ], +}; diff --git a/jest.config.ts b/jest.config.ts index 4f3bcdf..260b4e9 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -12,4 +12,4 @@ export default async (): Promise => { testMatch: ['**/?(*.)+(spec|test).+(ts)'], verbose: true }; -}; \ No newline at end of file +}; diff --git a/package.json b/package.json index 6c23e96..2ca1a19 100644 --- a/package.json +++ b/package.json @@ -11,12 +11,15 @@ "build": "tsc", "build:watch": "tsc --watch", "test": "jest", - "test:watch": "jest --watchAll" + "test:watch": "jest --watchAll", + "format:check": "prettier --check .", + "format": "prettier --check --write ." }, "devDependencies": { "@types/jest": "^29.5.1", "@types/node": "^20.2.3", "jest": "^29.5.0", + "prettier": "^2.8.8", "ts-jest": "^29.1.0", "ts-node": "^10.9.1", "typescript": "^5.0.4" diff --git a/src/index.test.ts b/src/index.test.ts index 2f40a6c..d977816 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -1,8 +1,8 @@ -import {project} from "./index"; +import { project } from './index'; describe('project', () => { it('should add project as prefix', () => { const withPrefix = project('hello'); expect(withPrefix).toEqual(`project hello`); - }) -}) \ No newline at end of file + }); +}); diff --git a/src/index.ts b/src/index.ts index bf48f76..2a6523b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ const project = (name: string) => { return `project ${name}`; -} +}; -export { project }; \ No newline at end of file +export { project }; diff --git a/test/global-setup.ts b/test/global-setup.ts index 1249d19..391935a 100644 --- a/test/global-setup.ts +++ b/test/global-setup.ts @@ -1,3 +1,3 @@ export default async () => { // ignore -} \ No newline at end of file +}; diff --git a/test/global-teardown.ts b/test/global-teardown.ts index 1249d19..391935a 100644 --- a/test/global-teardown.ts +++ b/test/global-teardown.ts @@ -1,3 +1,3 @@ export default async () => { // ignore -} \ No newline at end of file +}; diff --git a/tsconfig.json b/tsconfig.json index 9717e67..f987821 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,11 +12,9 @@ "skipLibCheck": true, "sourceMap": true, "strict": true, - "target": "ES2017", + "target": "ES2017" }, - "include": [ - "src" - ], + "include": ["src"], "exclude": [ "src/**/*.test.ts", "src/**/*.spec.ts", @@ -24,4 +22,4 @@ "src/**/*.spec.tsx", "src/**/*.snap" ] -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index ec335ea..c143fd1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1910,6 +1910,11 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" +prettier@^2.8.8: + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== + pretty-format@^29.0.0, pretty-format@^29.5.0: version "29.5.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.5.0.tgz#283134e74f70e2e3e7229336de0e4fce94ccde5a"