Commit Graph

144 Commits (master)

Author SHA1 Message Date
Lucas Azzola 2e655a3755 1.7.4 2017-10-03 19:46:42 +10:00
Lucas Azzola 33a1f59e01 Ensure package is published from dist/ with correct version number (#2963) 2017-10-03 19:34:08 +11:00
Simon Lydell 63916beebb Try to fix cosmiconfig in the built version of Prettier (#2930) 2017-09-29 09:27:50 +02:00
Simon Lydell 06c9127f02 Update instructions for running tests against dist
Fixes #2819.
2017-09-14 21:56:59 +02:00
Simon Lydell 1375e6880a Generate ISSUE_TEMPLATE.md on build 2017-09-14 00:14:35 +02:00
Simon Lydell 8ba2acadbb Make sure that shown playground Prettier version always is in sync 2017-09-12 22:17:06 +02:00
Ika 3db840258b chore(build): update ISSUE_TEMPLATE.md before publish (#2776) 2017-09-09 23:39:11 +10:00
Simon Lydell a29b407dda Generalize run-external-typescript-tests.js (#2742)
... so it can run external Flow tests as well (or any external tests for
that matter).
2017-09-03 13:41:07 -07:00
Simon Lydell f903ae45ed Make run-external-typescript-tests.js cross-platform (#2737)
The old version had quite a bit of code related to grouping errors,
showing the number of errors per group and saving the groups of errors
to different files. However, now there are only 12 bad tests so I didn't
bother porting that logic to the new version. Instead, the errors a
simply printed to stdout.
2017-09-03 15:59:19 +02:00
Levi Thomason 828a7b8f0d docs(readme): add and sort cli options (#2700)
* chore(build): auto generate toc

* docs(readme): add and sort cli options

* refactor(build): move toc to seperate task
2017-08-29 13:39:49 -07:00
Lucas Azzola 8a45377760 Load babylon parser for json formatting (#2620) 2017-08-15 21:54:10 +10:00
Joseph Frazier a78d1389f6 Use babylon.parseExpression for JSON (#2476)
* Add comments showing parser arguments

Since this is how they are invoked, the comments make it easier to maintain.

* Use babylon.parseExpression for JSON

See https://github.com/prettier/prettier/issues/2378#issuecomment-314600778

Note that this doesn't yet print comments:

    echo '{/*comment*/"K":"V"}' | ./bin/prettier.js --parser json

* Remove parser-json.js

This reduces duplicate code in the built package.
See https://github.com/prettier/prettier/pull/2476#pullrequestreview-50181398

* Add test with block comment in JSON

* Fix test with block comment in JSON

* Add test with line comment in JSON

* Don't build now-redundant parser-json.js
2017-07-24 11:43:49 +10:00
Lucas Azzola 71b2004391 Cleanup unused nodes, and turn on importMeta babylon plugin (#2498)
* Cleanup unused AST nodes

* Add tests for JSXNamespacedName

* Turn on importMeta babylon plugin

* Add tests for DeclareTypeAlias

* Add back TS*Keyword nodes, fix TS optional destructuring
2017-07-16 23:59:49 +10:00
Joseph Frazier 9290dd8803 Add some standardjs-esque eslint rules (#2401)
I experimented with simplifying the eslint config to just use eslint-config-standard and eslint-config-prettier. There were too many errors to make it a quick change, but I did find a few useful rules we could adopt instead.

---

* lint: Remove useless return statements

http://eslint.org/docs/rules/no-useless-return

* lint: Split declarations into multiple statements

http://eslint.org/docs/rules/one-var

* lint: Remove unneeded ternary operators

http://eslint.org/docs/rules/no-unneeded-ternary

* lint: Require symbol descriptions

http://eslint.org/docs/rules/symbol-description

* lint: Disallow declarations in nested blocks

http://eslint.org/docs/rules/no-inner-declarations

* lint: Disallow yoda conditions

http://eslint.org/docs/rules/yoda

* Revert "lint: Disallow yoda conditions"

See discussion at https://github.com/prettier/prettier/pull/2401#discussion_r125750068

This reverts commit f3b568d5bd48a742460cb0f805d1be38d8f61a40.
2017-07-05 16:54:46 -04:00
Evilebot Tnawi a0cadad222 feat(cli): support multiple patterns with ignore pattern (#2356) 2017-07-04 17:55:06 +02:00
Frank Li 80f38ce75b Website (#2241)
* initial docusaurus set-up

* Delete why-prettier.md

* Update README.md

* Update Docusaurus structure

* Update package.json

* Update siteConfig.js

* Remove ~ files

* chore(website): update build script

* Add redirect script

* Get eslint working on website

* Fix to allow for baseUrl of '/'

* Update docusaurus version

* Update README.md

* Change redirect script to use baseUrl of '/'

* Fix index.js formatting

* Load redirect script

* General cleanup

* Add projects using prettier
* Update service worker to just scope to playground
* Reduce link repeatition
* Link "Try it out" button to /playground/
* Make header of playground approximately same as main site
* Remove .html from URLs (e.g. users.html -> users/)
* Link Gitter Chat

* Add circleci.yml

* Only run builds on master

* Do deployment using Travis
2017-07-02 10:14:24 +10:00
Simon Lydell 7b176b5d73 Merge pull request #2341 from lydell/shelljs
Convert build.sh into build.js using shelljs
2017-06-29 18:26:27 +02:00
Lucas Azzola 968cc3cb2b Delete fuzzer2.js 2017-06-29 08:52:14 +10:00
Simon Lydell 20a0723fc1 Convert build.sh into build.js using shelljs
For better cross platform compatibility.
2017-06-28 22:34:59 +02:00
Simon Lydell ba51d2dfa8 Enable linting of build scripts 2017-06-28 21:37:33 +02:00
Lucas Azzola 678964b8de fix(typescript): don't add namespace keyword to global declaration, fixes #2327 (#2329) 2017-06-28 07:53:10 -07:00
Christopher Chedeau b257c68772 Use perl instead of sed for replacing eval 2017-06-27 10:02:31 -07:00
Christopher Chedeau 1e48f34ac8 Copy README.md to the dist/ folder (#2284)
Fixes #2275
2017-06-27 09:48:06 -07:00
Lucas Azzola eccb17495a Website: speed up load time, enable service worker (#2172)
* feat(website): speed up website load 💥

* chore(package): fix bad merge
2017-06-18 20:25:27 +10:00
Joseph Frazier 33a1c713d5 Dedupe copy/pasted code in build.sh (#2179) 2017-06-17 11:39:30 -10:00
Joseph Frazier d46b778dba Add json parser to dist/ build (#2178)
This fixes the build, as shown by:

    yarn build
    yarn test --prod -- tests/json/
2017-06-17 17:09:48 -04:00
Joseph Frazier fe8cc68e56 Fix dist/ build on machines that don't support `sed -i ''` (#2175)
Here's an example of the error that happens upon `yarn build`:

    sed: can't read : No such file or directory
2017-06-17 08:59:45 -10:00
Iaroslav Voloshchuk 89971285e4 Move devDependencies to dependencies (#2124)
fixes https://github.com/prettier/prettier/issues/2121

* move runtime deps to npm deps

* Fix (dev)dependencies

See https://github.com/prettier/prettier/pull/2124#discussion_r121795774

* Remove dependencies from dist/package.json

See https://github.com/prettier/prettier/pull/2124#issuecomment-308259138
2017-06-17 10:36:50 -04:00
Lucas Azzola 40c41f232f Website: usability improvements (#2118)
* feat(website): use worker thread for formatting

* Create index.html

Remove step=5
2017-06-13 09:20:13 -07:00
Lucas Azzola 364c38de0d Implement custom parser API (#1783)
* feat(api): add custom parser API

* test(api): add integration test for parser resolution

* chore(api): fix build after resolving conflicts

* docs(api): document custom parser API

* docs(api): fix typo

* chore(build): add parse5 to build and support yarn test --prod
2017-06-12 16:51:12 +10:00
Christopher Chedeau f702c2c614 1.4.3
* Fix support for node 4 (#1988)
* Fix website on iOS Safari (#1970)

Formatting change:
* Position JSX whitespace (`{" "}`) at the end of lines (#1964)

Lots of small fixes, mainly for TypeScript.
2017-06-07 15:48:34 -07:00
Martin V 820e39b2b3 Clean up build script, add Babel for docs js bundles (#1970)
* Clean up build script, add Babel for docs js bundles

* Update package.json
2017-06-07 15:20:48 -07:00
Joseph Frazier d9e4d8f1b8 Remove unnecessary 'else' after 'return' (#1987)
As mentioned in at the end of
https://github.com/prettier/prettier/pull/1983/files#r120222081
2017-06-05 15:12:59 -07:00
Jon Wong e33d6773d6 Adding support for `graphql` (#1982)
* Initial GraphQL implementation

This is the bare minimum amount of code to make graphql work. Turns out it's pretty easy to add support for other languages :)

* Fixing support for `graphql` parsing

There was a few structural changes with the addition of CSS and Typescript that we had to take into account.

* Fixing file glob, adding `graphql` to yarn.lock

* Removing extraneous file

* Adding `graphql` parser, style changes

* Splitting out graphql printer

* Removing merge conflict

* Fixing yarn.lock

* Addressing code review, using `createError`

* Adding release config

* Using exact version

* Removing destructuring
2017-06-05 12:34:08 -07:00
Christopher Chedeau f56f9e5e8f 1.4.1
This fixes all the TypeScript problems reported and a few regressions from 1.4.0.
2017-06-02 16:25:57 -07:00
Christopher Chedeau 3d175cc305 Remove eval for npm release (#1925)
Fixes #1895
2017-06-02 16:19:26 -07:00
Christopher Chedeau d55640087e Fix building docs (#1838)
The hackiness continues! I'm now bundling an existing bundle again in order for it to get exported as a global variable :p There's likely a better solution, but it kind of works.

Because I have to regenerate the docs, I just tagged it as 1.4.0-beta and added typescript and postcss in there.
2017-05-31 13:37:35 -07:00
Christopher Chedeau f4296550db Introduce Webpack 2 to fix postcss bundling (#1836)
It turns out rollup doesn't use the same algorithm for bundling commonjs files when there are cycles as node, which breaks postcss: https://twitter.com/Rich_Harris/status/869021144191561729. Webpack works just fine with it.

This sucks to have this rollup/webpack frankenstein but I really want to be able to release and don't really want to spend yet another day or two trying to make it work well.
2017-05-31 11:59:33 -07:00
Christopher Chedeau 05b921efdd Build the dist/ with rollup (#1794) 2017-05-28 21:49:41 -07:00
Simon Lydell 378682350f Improve ESLint setup and fix errors (#1656)
* Improve ESLint setup

- Uses `eslint:recommended` + a handful more rules.
- Uses .eslintignore so that editors can understand which files to lint.
- Uses .eslintrc<strong>.js</strong> so more editors get syntax highlighting.

* Fix ESLint errors

About half of them were fixed by `eslint . --fix`.
2017-05-21 12:11:09 -07:00
Simon Lydell bc5186e544 Run Prettier on all source files (#1648)
This commit updates `npm run format:all` to not only format .js files in
src/ and bin/, but also tests_config/ and scripts/, as well as all
jsfmt.spec.js files.

It also includes the result of running `npm run format:all`, except
changes to src/ and bin/.
2017-05-21 08:13:11 -07:00
Lucas Azzola 8f00393a56 tools(typescript): do not report SyntaxErrors as errors (#1647) 2017-05-21 07:53:30 -07:00
Lucas Azzola 1ea4ad4e30 tools(typescript): add script to run all TypeScript tests (#1606) 2017-05-14 03:26:37 -07:00
Simon Lydell dc93bdc983 Sync the Flow tests (#1163)
* Extract custom tests from tests/flow/

Approach:

1. Remove all .js files in tests/flow except .snap.js files.
2. Copy over all .js files from tests/ in the flow repo.
3. Go through the diff looking for deletions.
   - It was easy to see which deletions were due to changes in the tests
     due to updates in the flow repo.
   - For the rest of the deletions, I used `git blame` to verify that
     they had been added by us since the flow tests were copied over.

This makes tests/flow/ simply a copy of the tests from the flow repo,
making it easier to sync with the upstream flow tests in the future.

* Add a script for syncing the flow tests

* Sync the flow tests
2017-04-08 07:52:38 -07:00