Skip to content

Commit

Permalink
feat!: switch to prettier for formatting (#259)
Browse files Browse the repository at this point in the history
* feat!: switch to prettier for formatting

BREAKING CHANGE: Switch to prettier as the code formatter.

Fixes: #156
  • Loading branch information
ofrobots committed Feb 7, 2019
1 parent e33db48 commit 5f35e09
Show file tree
Hide file tree
Showing 18 changed files with 264 additions and 455 deletions.
8 changes: 0 additions & 8 deletions .prettierrc

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- **Catch style issues & programmer errors early**. Save precious code review time by eliminating back-and-forth between reviewer & contributor.
- **Opinionated, but not to a fault**. We recommend you use the default configuration, but if you *need* to customize compiler or linter config, you can.

Under the covers, we use [tslint][tslint-url] to enforce the style guide and provide automated fixes, and [clang-format][clang-format-url] to re-format code.
Under the covers, we use [tslint][tslint-url] to enforce the style guide and provide automated fixes, and [prettier][prettier-url] to re-format code.

Made with ❤️ by the Google Node.js team.

Expand Down Expand Up @@ -59,7 +59,7 @@ See [LICENSE](LICENSE)
[circle-image]: https://circleci.com/gh/google/ts-style.svg?style=svg
[circle-url]: https://circleci.com/gh/google/ts-style
[clang-format-url]: https://github.com/angular/clang-format
[prettier-url]: https://prettier.io/
[codecov-image]: https://codecov.io/gh/google/ts-style/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/google/ts-style
[david-dev-image]: https://david-dm.org/google/ts-style/dev-status.svg
Expand Down
73 changes: 20 additions & 53 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"gts": "build/src/cli.js"
},
"files": [
".clang-format",
"CHANGELOG.md",
"LICENSE",
"README.md",
"build/src",
"build/types",
"prettier.config.js",
"tsconfig-google.json",
"tsconfig.json",
"tslint.json"
Expand Down Expand Up @@ -41,7 +41,6 @@
"license": "Apache-2.0",
"dependencies": {
"chalk": "^2.4.1",
"clang-format": "1.2.3",
"diff": "^4.0.1",
"entities": "^1.1.1",
"inquirer": "^6.0.0",
Expand All @@ -63,6 +62,7 @@
"@types/ncp": "^2.0.1",
"@types/node": "^10.0.3",
"@types/pify": "^3.0.2",
"@types/prettier": "^1.15.2",
"@types/rimraf": "^2.0.2",
"@types/tmp": "^0.0.33",
"@types/update-notifier": "^2.2.0",
Expand Down
4 changes: 4 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
singleQuote: true,
trailingComma: 'es5',
};
4 changes: 2 additions & 2 deletions src/clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import chalk from 'chalk';
import * as ts from 'typescript';

import {Options} from './cli';
import {getTSConfig, rimrafp} from './util';
import { Options } from './cli';
import { getTSConfig, rimrafp } from './util';

interface TSConfig {
compilerOptions: ts.CompilerOptions;
Expand Down
14 changes: 7 additions & 7 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import * as path from 'path';
import * as meow from 'meow';
import * as updateNotifier from 'update-notifier';
import {init} from './init';
import {clean} from './clean';
import { init } from './init';
import { clean } from './clean';

const packageJson = require('../../package.json');

Expand Down Expand Up @@ -69,10 +69,10 @@ const cli = meow({
$ gts fix src/file1.ts src/file2.ts
$ gts clean`,
flags: {
help: {type: 'boolean'},
yes: {type: 'boolean', alias: 'y'},
no: {type: 'boolean', alias: 'n'},
'dry-run': {type: 'boolean'},
help: { type: 'boolean' },
yes: { type: 'boolean', alias: 'y' },
no: { type: 'boolean', alias: 'n' },
'dry-run': { type: 'boolean' },
},
});

Expand Down Expand Up @@ -120,7 +120,7 @@ async function run(verb: string, files: string[]): Promise<boolean> {
}
}

updateNotifier({pkg: packageJson}).notify();
updateNotifier({ pkg: packageJson }).notify();

if (cli.input.length < 1) {
usage();
Expand Down
Loading

0 comments on commit 5f35e09

Please sign in to comment.