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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(eslint, prettier): describe auto fix of import sorts in READMEs #109

Merged
merged 1 commit into from
Feb 13, 2023
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
6 changes: 6 additions & 0 deletions .changeset/pretty-pets-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@mheob/prettier-config': patch
'@mheob/eslint-config': patch
---

Fix the README files after the change of using ESLint to fix the imports.
29 changes: 26 additions & 3 deletions packages/eslint-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ module.exports = {
};
```

## Overwrite Rules

If you need to override some rules you can do it this way:

```js
Expand All @@ -62,8 +64,29 @@ module.exports = {
root: true, // optional
extends: ['@mheob/eslint-config'],
rules: {
'prettier/prettier': 'off',
'no-console': 'warn',
'prettier/prettier': 'off',
'simple-import-sort/imports': [
'error',
{
groups: [
// Side effect imports
['^\\u0000'],
// Node.js builtins
['^node:'],
// Packages
['^@?\\w'],
// Internal packages
['^~/?\\w'],
// Absolute imports
['^'],
// Relative imports
['^\\.'],
// Style imports
['^.+\\.s?css$'],
],
},
],
},
};
```
Expand All @@ -80,8 +103,8 @@ module.exports = {
files: ['*.jsx', '*.tsx'],
settings: { react: { version: 'detect' } },
rules: {
'react/jsx-no-useless-fragment': 'warn',
'react/react-in-jsx-scope': 'off',
'react/jsx-no-useless-fragment': 'error',
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
},
},
],
Expand Down
10 changes: 2 additions & 8 deletions packages/prettier-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,21 @@ If you need to override some settings you can do it this way:
module.exports = {
...require('@mheob/prettier-config'),
semi: false,
importOrder: ['^@company/(.*)$', '^[./]'],
useTabs: false,
};
```

## Ruleset

This configuration uses the [`@trivago/prettier-plugin-sort-imports`](https://github.com/trivago/prettier-plugin-sort-imports) plugin and set these styles:
This configuration uses these styles:

```js
const sortImports = require('@trivago/prettier-plugin-sort-imports');

/** @type {import('prettier').Config} */
module.exports = {
plugins: [sortImports],
arrowParens: 'always',
endOfLine: 'lf',
printWidth: 100,
proseWrap: 'always',
importOrder: ['^node:', '<THIRD_PARTY_MODULES>', '^[./]'],
importOrderSeparation: true,
importOrderSortSpecifiers: true,
singleQuote: true,
semi: true,
trailingComma: 'all',
Expand Down