Does we have any formatter for lit like eslint or prettier in VScode? #4033
Answered
by
p-ob
jitendraP-ashutec
asked this question in
Q&A
-
I have used eslint and prettier for code formation, but some time its not format property specially into HTML template? do we have any support for it ? |
Beta Was this translation helpful? Give feedback.
Answered by
p-ob
Jul 20, 2023
Replies: 1 comment
-
We've been using eslint and prettier for quite some time with our lit monorepos. Here's an example of what we've set up and it's carried on strong for quite some time (it's been awhile since I've reviewed, so I'm sure it could be improved upon). Packages:
{
"printWidth": 120,
"overrides": [
{
"files": "*.ts,*.js",
"options": {
"htmlWhitespaceSensitivity": "strict"
}
},
{
"files": "*.scss",
"options": {
"parser": "scss",
"singleQuote": true,
"printWidth": 200
}
},
{
"files": "*.md",
"options": {
"printWidth": 200
}
}
]
}
{
"root": true,
"env": {
"browser": true,
"es6": true
},
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"rules": {
"no-console": "warn",
"no-var": "error",
"prefer-const": "error",
"curly": "error",
"lit/no-duplicate-template-bindings": "error",
"lit/no-template-map": "error",
"lit/no-useless-template-literals": "error",
"lit/attribute-value-entities": "error",
"lit/binding-positions": "error",
"lit/no-property-change-update": "error",
"lit/no-invalid-html": "error",
"eqeqeq": "error",
"no-unused-vars": "off"
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2020
},
"plugins": ["prettier", "lit"],
"parser": "@typescript-eslint/parser"
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jitendraP-ashutec
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We've been using eslint and prettier for quite some time with our lit monorepos.
Here's an example of what we've set up and it's carried on strong for quite some time (it's been awhile since I've reviewed, so I'm sure it could be improved upon).
Packages:
.prettierrc
: