Skip to content

Commit

Permalink
feat: exporting our prettier config (#58)
Browse files Browse the repository at this point in the history
* feat: exporting our shared prettier config to a `/prettier`

* chore(deps): running `npm audit fix`
  • Loading branch information
erunion authored Mar 22, 2020
1 parent b649f4c commit 8d3fa61
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 28 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ Create a `.eslintrc` file with the following contents:
* `@readme/eslint-config/react`
* `@readme/eslint-config/testing`

### Prettier
Included in this is our shared Prettier config. You can use it in your application by adding the following to your `package.json`:

```json
"prettier": "@readme/eslint-config/prettier"
```

## Contributing
To assist in cleaner commit logs and a better changelog, all commit messages must be formatted against the https://commitlint.js.org/ standards.

Expand Down
21 changes: 3 additions & 18 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const prettierConfig = require('./prettier');

module.exports = {
extends: [
'airbnb-base',
Expand All @@ -16,11 +18,7 @@ module.exports = {
'eslint-comments/no-unused-disable': 'error',

'func-names': 'off',

'import/default': 'off',
'import/named': 'off', // @fixme Disabling this for now, but there are some weird callouts with it.
'import/order': 'off',

'no-constructor-return': 'error',
'no-dupe-else-if': 'error',
'no-else-return': ['error', { allowElseIf: true }],
Expand All @@ -34,37 +32,24 @@ module.exports = {

'prefer-destructuring': 'off',

'prettier/prettier': [
'error',
{
printWidth: 120,
singleQuote: true,
trailingComma: 'es5',
},
],
'prettier/prettier': ['error', prettierConfig],

'sonarjs/cognitive-complexity': 'off',
'sonarjs/no-collapsible-if': 'off',
'sonarjs/no-duplicate-string': 'off',
'sonarjs/no-duplicated-branches': 'off',
'sonarjs/no-identical-functions': 'off', // @todo We should fix these.
'sonarjs/prefer-immediate-return': 'off', // @todo We should fix these.

'unicorn/catch-error-name': ['error', { caughtErrorsIgnorePattern: '^(error|err|e)$' }],
// "unicorn/consistent-function-scoping": "error", // Maybe?
'unicorn/custom-error-definition': 'error',
'unicorn/error-message': 'error',
'unicorn/new-for-builtins': 'error',
'unicorn/no-array-instanceof': 'error',
// "unicorn/no-for-loop": "error", // Maybe?
'no-nested-ternary': 'off', // Disabled in favor of `unicorn/no-nested-ternary` which has better nesting detection.
'unicorn/no-nested-ternary': 'error',
'unicorn/no-unreadable-array-destructuring': 'error',
'unicorn/no-unsafe-regex': 'error',
'unicorn/no-unused-properties': 'error',
// "unicorn/prefer-includes": "error", // Maybe?
// "unicorn/prefer-query-selector": "error", // Maybe?
'unicorn/prefer-starts-ends-with': 'off', // @todo We should resolve these.
'unicorn/prefer-type-error': 'error',
'unicorn/throw-new-error': 'error',
},
Expand Down
27 changes: 17 additions & 10 deletions package-lock.json

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

5 changes: 5 additions & 0 deletions prettier.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
arrowParens: 'avoid',
printWidth: 120,
singleQuote: true,
};

0 comments on commit 8d3fa61

Please sign in to comment.