Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juliancataldo/eslint-plugin-playground
https://github.com/juliancataldo/eslint-plugin-playground
Last synced: 14 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/juliancataldo/eslint-plugin-playground
- Owner: JulianCataldo
- Created: 2024-02-22T07:24:35.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-02-22T08:08:23.000Z (9 months ago)
- Last Synced: 2024-10-15T01:06:38.322Z (29 days ago)
- Language: TypeScript
- Size: 39.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ESLint Plugin Playground
Experiment for making [ESLint Stylistic](https://eslint.style/) to format like
[Prettier does](https://prettier.io/blog/2020/08/24/2.1.0.html) for `html` template tag literals (and `svg`, `css`).It is just using Prettier inside the template literal. This is a analogous to [ESLint plugin format](https://github.com/antfu/eslint-plugin-format), but for embedded languages.
This is my first attempt at making an ESLint plugin, so expect this to be very naive.
---
## Current issues
- Trim remaining surrounding whitespace
- Inherit indenting level
- How are nested literals supposed to behave?
- Should extract interpolations from the formatting process
- Replacing the text seems to block further processing for nested templates## Try with the testbed
```
pnpm i
pnpm dev
```## Original
```ts
const name = `Rantanplan`
const animals = [
`dog`,"cat"]
export default createBeerBottle({
drink: ({ url }) => html`
${url}
It's a 404!
div>
${
// My eyes bleed
name + 'dddd'}
${animals.map((e,i)=>html`
${e} / ${i}
`)}
`,
});```
## With Prettier
```ts
const name = `Rantanplan`;
const animals = [`dog`, "cat"];export default createBeerBottle({
drink: ({ url }) => html`
${url}
It's a 404!
${
// My eyes bleed
name + "dddd"
}
${animals.map(
(e, i) => html`
${e} / ${i}
`,
)}
`,
});```
## Current result
```ts
const name = `Rantanplan`;
const animals = [
`dog`, "cat"
];export default createBeerBottle({
drink: ({ url }) => html` ${url}
It's a 404!
${ // My eyes bleed name + 'dddd'}
${animals.map((e,i)=>html`
${e} / ${i}
`)}
`
,
});```
---