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

turn off unicorn/template-indent #269

Merged
merged 32 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
254a793
add template indent
gurgunday Nov 12, 2023
c1c2954
only remove html from default rule config
gurgunday Nov 13, 2023
0664876
make template-indent a *special rule*
gurgunday Nov 13, 2023
1ae4b25
feedback
gurgunday Nov 13, 2023
c3d1830
remove html comment
gurgunday Nov 13, 2023
797a8ad
simplify
gurgunday Nov 13, 2023
4789e63
Update README.md
gurgunday Nov 13, 2023
f52c23e
alphabet
gurgunday Nov 13, 2023
837de58
Merge branch 'uni' of https://github.com/gurgunday/eslint-config-pret…
gurgunday Nov 13, 2023
7bc2e94
alphabet
gurgunday Nov 13, 2023
b7cad84
update
gurgunday Nov 13, 2023
f219271
sort
gurgunday Nov 13, 2023
a90b71b
readme
gurgunday Nov 13, 2023
44d72b1
validator
gurgunday Nov 13, 2023
9b4a21d
add comments
gurgunday Nov 13, 2023
7ff5d69
case where firstOption is undefined
gurgunday Nov 13, 2023
91ddff1
remove extra
gurgunday Nov 13, 2023
b606212
only keep supported keywords
gurgunday Nov 13, 2023
4873540
add markdown and alphabetical order
gurgunday Nov 14, 2023
299ec2d
fix!
gurgunday Nov 14, 2023
ec831f8
prettier
gurgunday Nov 14, 2023
a011399
optional
gurgunday Nov 14, 2023
b3fad8e
simplify and remove array generation
gurgunday Nov 14, 2023
d16a829
remove unnecessary boolean constructor
gurgunday Nov 23, 2023
3a52c6c
Merge branch 'main' into uni
lydell Dec 2, 2023
e2b3c69
I don’t dare shipping ?. right now
lydell Dec 2, 2023
be4f66f
styled does not cause conflicts in the end (readme, tests)
lydell Dec 2, 2023
9404e90
Improve readme
lydell Dec 2, 2023
bf4067a
Improve tests
lydell Dec 2, 2023
56d9497
Add GraphQL comment
lydell Dec 2, 2023
0d36379
Add unicorn/template-indent to CLI test (like all other special rules)
lydell Dec 2, 2023
f43284d
Test handling empty array
lydell Dec 2, 2023
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
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,41 @@ Example ESLint configuration:
}
```

### [unicorn/template-indent]
gurgunday marked this conversation as resolved.
Show resolved Hide resolved

**This rule can be used with certain options.**

This rule will automatically fix the indentation of multiline string templates, to keep them in alignment with the code they are found in. A configurable whitelist is used to ensure no whitespace-sensitive strings are edited.

The conflict is in templates tagged with an `html` function, in which case both Prettier and Unicorn try to indent the template.
gurgunday marked this conversation as resolved.
Show resolved Hide resolved

If you like this rule, it can be used just fine with Prettier as long as you add some extra configuration.
gurgunday marked this conversation as resolved.
Show resolved Hide resolved

Example ESLint configuration:

```js
gurgunday marked this conversation as resolved.
Show resolved Hide resolved
{
rules: {
"unicorn/template-indent": [
"error",
{
tags: [
"outdent",
"dedent",
"gql",
"sql",
// 'html',
"styled",
],
functions: ["dedent", "stripIndent"],
selectors: [],
comments: ["HTML", "indent"],
},
],
},
}
```

## Other rules worth mentioning

These rules don’t conflict with Prettier, but have some gotchas when used with Prettier.
Expand Down Expand Up @@ -827,3 +862,4 @@ When you’re done, run `npm test` to verify that you got it all right. It runs
[string formatting rules]: https://prettier.io/docs/en/rationale.html#strings
[vue/html-self-closing]: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-self-closing.md
[vue/max-len]: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/max-len.md
[unicorn/template-indent]: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/template-indent.md
gurgunday marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
"babel/quotes": 0,
"vue/html-self-closing": 0,
"vue/max-len": 0,
"unicorn/template-indent": 0,
gurgunday marked this conversation as resolved.
Show resolved Hide resolved

// The rest are rules that you never need to enable when using Prettier.
"array-bracket-newline": "off",
Expand Down