Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: exporting our prettier config #58

Merged
merged 2 commits into from
Mar 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
};