Skip to content

Commit

Permalink
Include all files in Prettier (#17050)
Browse files Browse the repository at this point in the history
This uses the "Expand directories" feature introduces in Prettier 2.0 to automatically format all supported file types.

Also, I fixed some badly formatted files.
  • Loading branch information
Jens Meindertsma committed Sep 14, 2020
1 parent 9959d7e commit a3c4772
Show file tree
Hide file tree
Showing 36 changed files with 120 additions and 158 deletions.
4 changes: 2 additions & 2 deletions examples/svg-components/.babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"presets": [ "next/babel" ],
"plugins": [ "inline-react-svg" ]
"presets": ["next/babel"],
"plugins": ["inline-react-svg"]
}
3 changes: 2 additions & 1 deletion examples/with-ant-design-less/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"presets": ["next/babel"],
"plugins": [
[
"import", {
"import",
{
"libraryName": "antd",
"style": true
}
Expand Down
13 changes: 8 additions & 5 deletions examples/with-ant-design-mobile/.babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"presets": ["next/babel"],
"presets": ["next/babel"],
"plugins": [
["import", {
"libraryName": "antd-mobile",
"style": "css"
}]
[
"import",
{
"libraryName": "antd-mobile",
"style": "css"
}
]
]
}
6 changes: 2 additions & 4 deletions examples/with-ant-design-pro-layout-less/.babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"presets": [
"next/babel"
],
"presets": ["next/babel"],
"plugins": [
[
"import",
Expand All @@ -11,4 +9,4 @@
}
]
]
}
}
8 changes: 2 additions & 6 deletions examples/with-cssed/.babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"presets": [
"next/babel"
],
"plugins": [
"babel-plugin-macros"
]
"presets": ["next/babel"],
"plugins": ["babel-plugin-macros"]
}
8 changes: 2 additions & 6 deletions examples/with-custom-babel-config/.babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"presets": [
"next/babel"
],
"plugins": [
"@babel/plugin-proposal-do-expressions"
]
"presets": ["next/babel"],
"plugins": ["@babel/plugin-proposal-do-expressions"]
}
4 changes: 1 addition & 3 deletions examples/with-custom-reverse-proxy/.babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"presets": [
"next/babel"
]
"presets": ["next/babel"]
}
6 changes: 3 additions & 3 deletions examples/with-filbert/.babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"presets": ["next/babel"],
"plugins": ["macros"]
}
"presets": ["next/babel"],
"plugins": ["macros"]
}
10 changes: 3 additions & 7 deletions examples/with-flow/.babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"presets": [
"next/babel"
],
"plugins": [
"transform-flow-strip-types"
]
}
"presets": ["next/babel"],
"plugins": ["transform-flow-strip-types"]
}
44 changes: 26 additions & 18 deletions examples/with-flow/flow-typed/next.js.flow
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
// @flow

declare module "next" {
declare module 'next' {
declare type NextApp = {
prepare(): Promise<void>;
getRequestHandler(): any;
render(req: any, res: any, pathname: string, query: any): any;
};
prepare(): Promise<void>,
getRequestHandler(): any,
render(req: any, res: any, pathname: string, query: any): any,
}
declare module.exports: (...opts: any) => NextApp
}

declare module "next/head" {
declare module.exports: Class<React$Component<any, any>>;
declare module 'next/head' {
declare module.exports: Class<React$Component<any, any>>
}

declare module "next/link" {
declare module.exports: Class<React$Component<{href: string, prefetch?: bool}, any>>;
declare module 'next/link' {
declare module.exports: Class<
React$Component<{ href: string, prefetch?: boolean }, any>
>
}

declare module "next/error" {
declare module.exports: Class<React$Component<{statusCode: number}, any>>;
declare module 'next/error' {
declare module.exports: Class<React$Component<{ statusCode: number }, any>>
}

declare module "next/document" {
declare export var Head: Class<React$Component<any, any>>;
declare export var Main: Class<React$Component<any, any>>;
declare export var NextScript: Class<React$Component<any, any>>;
declare module 'next/document' {
declare export var Head: Class<React$Component<any, any>>
declare export var Main: Class<React$Component<any, any>>
declare export var NextScript: Class<React$Component<any, any>>
declare export default Class<React$Component<any, any>> & {
getInitialProps: (ctx: {pathname: string, query: any, req?: any, res?: any, err?: any}) => Promise<any>;
renderPage(cb: Function): void;
};
getInitialProps: (ctx: {
pathname: string,
query: any,
req?: any,
res?: any,
err?: any,
}) => Promise<any>,
renderPage(cb: Function): void,
}
}
7 changes: 1 addition & 6 deletions examples/with-glamor/.babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"presets": ["next/babel"],
"plugins": [
[
"transform-react-jsx",
{ "pragma": "Glamor.createElement" }
]
]
"plugins": [["transform-react-jsx", { "pragma": "Glamor.createElement" }]]
}
5 changes: 1 addition & 4 deletions examples/with-linaria/.babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"presets": [
"next/babel",
"linaria/babel"
]
"presets": ["next/babel", "linaria/babel"]
}
10 changes: 3 additions & 7 deletions examples/with-lingui/.babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"presets": [
"next/babel"
],
"plugins": [
"macros"
]
}
"presets": ["next/babel"],
"plugins": ["macros"]
}
4 changes: 1 addition & 3 deletions examples/with-mobx-react-lite/.babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"presets": [
"next/babel"
]
"presets": ["next/babel"]
}
8 changes: 2 additions & 6 deletions examples/with-mobx-state-tree/.babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"presets": [
"next/babel"
],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }]
]
"presets": ["next/babel"],
"plugins": [["@babel/plugin-proposal-decorators", { "legacy": true }]]
}
4 changes: 1 addition & 3 deletions examples/with-mobx/.babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"presets": [
"next/babel"
],
"presets": ["next/babel"],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties", { "loose": true }]
Expand Down
2 changes: 1 addition & 1 deletion examples/with-mocha/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"presets": [["next/babel", { "preset-env": { "modules": "commonjs" } }]]
}
}
}
}
5 changes: 4 additions & 1 deletion examples/with-orbit-components/.babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"presets": ["next/babel"],
"plugins": [["styled-components", { "ssr": true }], "@kiwicom/babel-plugin-orbit-components"]
"plugins": [
["styled-components", { "ssr": true }],
"@kiwicom/babel-plugin-orbit-components"
]
}
19 changes: 11 additions & 8 deletions examples/with-react-intl/.babelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"presets": ["next/babel"],
"plugins": [
["babel-plugin-react-intl", {
"ast": true,
"idInterpolationPattern": "[sha512:contenthash:base64:6]",
"extractFromFormatMessageCall": true
}]
"presets": ["next/babel"],
"plugins": [
[
"babel-plugin-react-intl",
{
"ast": true,
"idInterpolationPattern": "[sha512:contenthash:base64:6]",
"extractFromFormatMessageCall": true
}
]
}
]
}
2 changes: 1 addition & 1 deletion examples/with-react-jss/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["next/babel"]
}
}
8 changes: 2 additions & 6 deletions examples/with-react-relay-network-modern/.babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"presets": [
"next/babel"
],
"plugins": [
["relay", { artifactDirectory: "__generated__" }]
]
"presets": ["next/babel"],
"plugins": [["relay", { "artifactDirectory": "__generated__" }]]
}
10 changes: 3 additions & 7 deletions examples/with-reason-relay/.babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"presets": [
"next/babel"
],
"plugins": [
"relay"
]
}
"presets": ["next/babel"],
"plugins": ["relay"]
}
4 changes: 1 addition & 3 deletions examples/with-reasonml-todo/.babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"presets": [
"next/babel"
],
"presets": ["next/babel"]
}
4 changes: 1 addition & 3 deletions examples/with-reasonml/.babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"presets": [
"next/babel"
]
"presets": ["next/babel"]
}
11 changes: 6 additions & 5 deletions examples/with-rebass/.babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"presets": [
"next/babel"
],
"presets": ["next/babel"],
"plugins": [
["styled-components", { "ssr": true, "displayName": true, "preprocess": false } ]
[
"styled-components",
{ "ssr": true, "displayName": true, "preprocess": false }
]
]
}
}
10 changes: 3 additions & 7 deletions examples/with-relay-modern/.babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"presets": [
"next/babel"
],
"plugins": [
"relay"
]
}
"presets": ["next/babel"],
"plugins": ["relay"]
}
4 changes: 1 addition & 3 deletions examples/with-styled-jsx-plugins/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"next/babel",
{
"styled-jsx": {
"plugins": [
"styled-jsx-plugin-postcss"
]
"plugins": ["styled-jsx-plugin-postcss"]
}
}
]
Expand Down
4 changes: 1 addition & 3 deletions examples/with-styled-jsx-scss/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"next/babel",
{
"styled-jsx": {
"plugins": [
"styled-jsx-plugin-sass"
]
"plugins": ["styled-jsx-plugin-sass"]
}
}
]
Expand Down
11 changes: 3 additions & 8 deletions examples/with-tailwindcss-emotion/.babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"presets": [
"next/babel"
],
"plugins": [
"macros",
"@emotion/babel-plugin"
]
}
"presets": ["next/babel"],
"plugins": ["macros", "@emotion/babel-plugin"]
}
2 changes: 1 addition & 1 deletion examples/with-typescript-eslint-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "next build",
"start": "next start",
"type-check": "tsc --pretty --noEmit",
"format": "prettier --write \"**/*.{js,ts,tsx}\"",
"format": "prettier --write .",
"lint": "eslint . --ext ts --ext tsx --ext js",
"test": "jest",
"test-all": "yarn lint && yarn type-check && yarn test"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"lint-eslint": "eslint . --ext js,jsx,ts,tsx --max-warnings=0",
"lint": "run-p lint-typescript prettier-check lint-eslint",
"lint-fix": "yarn prettier-fix && eslint . --ext js,jsx,ts,tsx --fix --max-warnings=0",
"prettier-check": "prettier --check \"**/*.{js,mjs,cjs,jsx,json,ts,tsx,md,mdx,css,html,yml,yaml,scss,less,graphql,graphqls,gql}\"",
"prettier-fix": "prettier --write \"**/*.{js,mjs,cjs,jsx,json,ts,tsx,md,mdx,css,html,yml,yaml,scss,less,graphql,graphqls,gql}\"",
"prettier-check": "prettier --check .",
"prettier-fix": "prettier --write .",
"types": "lerna run types --stream",
"typescript": "lerna run typescript",
"prepublish": "lerna run prepublish",
Expand Down
4 changes: 1 addition & 3 deletions test/.babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"presets": [
"next/babel"
]
"presets": ["next/babel"]
}
Loading

0 comments on commit a3c4772

Please sign in to comment.