Skip to content

Commit

Permalink
Prettier Config: Add type-checking (#21053)
Browse files Browse the repository at this point in the history
* Prettier Config: Add type-checking

* Prettier Config: Disable ESLint validation for union type
  • Loading branch information
aduth authored Apr 1, 2020
1 parent c5fab6d commit 8aa3ad4
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
6 changes: 6 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"@storybook/react": "5.3.2",
"@types/jest": "24.0.25",
"@types/lodash": "4.14.149",
"@types/prettier": "1.19.0",
"@types/qs": "6.9.1",
"@types/requestidlecallback": "0.3.1",
"@types/sprintf-js": "1.1.2",
Expand Down
18 changes: 17 additions & 1 deletion packages/prettier-config/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
module.exports = {
/** @typedef {import('prettier').Options} PrettierOptions */

/**
* @typedef WPPrettierOptions
*
* @property {boolean} [parenSpacing=true] Insert spaces inside parentheses.
*/

// Disable reason: The current JSDoc tooling does not yet understand TypeScript
// union types.

/* eslint-disable jsdoc/valid-types */
/** @type {PrettierOptions & WPPrettierOptions} */
/* eslint-enable jsdoc/valid-types */
const config = {
useTabs: true,
tabWidth: 4,
printWidth: 80,
Expand All @@ -10,3 +24,5 @@ module.exports = {
semi: true,
arrowParens: 'always',
};

module.exports = config;
1 change: 1 addition & 0 deletions packages/prettier-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"lib/index.js"
],
"main": "lib/index.js",
"types": "build-types",
"publishConfig": {
"access": "public"
}
Expand Down
8 changes: 8 additions & 0 deletions packages/prettier-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "lib",
"declarationDir": "build-types"
},
"include": [ "lib/**/*" ]
}

0 comments on commit 8aa3ad4

Please sign in to comment.