Skip to content

Commit

Permalink
feat: lit rule, use tabs, fix stylelint html 🥳
Browse files Browse the repository at this point in the history
+ remove old deps.
+ hide ts config
  • Loading branch information
JulianCataldo committed Mar 26, 2023
1 parent ceb5989 commit 15e9dc0
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 197 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import("@types/eslint").Linter.Config} */
/** @type {import("eslint").Linter.Config} */

module.exports = {
// FIXME: ./node_modules/ prefix is required, why?
Expand Down
5 changes: 4 additions & 1 deletion configs/.editorconfig-example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
root = true

[*]
indent_style = space
indent_style = tab
indent_size = 2
end_of_line = lf
charset = utf-8
Expand All @@ -16,3 +16,6 @@ indent_size = 4

[*.md]
trim_trailing_whitespace = false

[*.yaml]
indent_style = space
70 changes: 42 additions & 28 deletions configs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ This means aligning to Prettier defaults, air-bnb rules, etc.
- [Extension(s)](#extensions)
- [Settings](#settings)
- [Prettier](#prettier)
- [Installations](#installations-1)
- [Installation](#installation-1)
- [Configuration](#configuration-1)
- [Editorconfig](#editorconfig)
- [VSCode](#vscode-1)
- [Extension(s)](#extensions-1)
- [Settings](#settings-1)
- [Stylelint](#stylelint)
- [Installations](#installations-2)
- [Installations](#installations-1)
- [Configuration](#configuration-2)
- [VSCode](#vscode-2)
- [Extension(s)](#extensions-2)
Expand All @@ -48,7 +48,6 @@ This means aligning to Prettier defaults, air-bnb rules, etc.
- [Extension(s)](#extensions-4)
- [TypeScript](#typescript)
- [VSCode](#vscode-5)
- [Project settings boilerplate](#project-settings-boilerplate)
- [VSCode](#vscode-6)
- [Languages](#languages)
- [Astro](#astro)
Expand Down Expand Up @@ -79,7 +78,6 @@ Atomic configs import is planned, as each project might not need the whole range
# v—————————————————————————————————— Base
pnpm i -D \
eslint \
@types/eslint \
eslint-config-airbnb-base

# v—————————————————————————————————— Prettier compat.
Expand Down Expand Up @@ -124,10 +122,12 @@ eslint-plugin-mdx

### Configuration

In `.eslintrc.cjs`:
```sh
touch ./.eslintrc.cjs && code -r ./.eslintrc.cjs
```

```js
/** @type {import("@types/eslint").Linter.Config} */
/** @type {import("eslint").Linter.Config} */

module.exports = {
// Prevent cascading in contained folders
Expand Down Expand Up @@ -193,26 +193,20 @@ In your `settings.json`:

## Prettier

### Installations
### Installation

```sh
# v—————————————————————————————————— Base
pnpm i -D \
@types/prettier \
prettier

# v—————————————————————————————————— Astro
pnpm i -D \
prettier-plugin-astro \
postcss-html
pnpm i -D prettier
```

### Configuration

In `.prettierrc.cjs`:
```sh
touch ./.prettierrc.cjs && code -r ./.prettierrc.cjs
```

```js
/** @type {import("@types/prettier").Options} */
/** @type {import("prettier").Options} */

module.exports = {
/**
Expand Down Expand Up @@ -324,14 +318,14 @@ pnpm i -D \
stylelint-config-standard-scss \
stylelint-config-recommended-scss

# v—————————————————————————————————— Vue
# v—————————————————————————————————— Astro / Vue / HTML…
pnpm i -D \
stylelint-config-recommended-vue \
postcss-html
postcss-html \
stylelint-config-html

# v—————————————————————————————————— Astro
# v—————————————————————————————————— Vue
pnpm i -D \
postcss-html
stylelint-config-recommended-vue

# v—————————————————————————————————— Prettier compat.
pnpm i -D \
Expand All @@ -340,7 +334,9 @@ stylelint-config-prettier

### Configuration

In `stylelint.config.cjs`:
```sh
touch ./stylelint.config.cjs && code -r ./stylelint.config.cjs
```

```js
/** @type {import("@types/stylelint").Options} */
Expand Down Expand Up @@ -391,8 +387,24 @@ In your `settings.json`:
```jsonc
{
// …
"stylelint.validate": ["css", "postcss", "scss", "vue", "astro"],
"stylelint.snippet": ["css", "postcss", "scss", "vue", "astro"]
"stylelint.validate": [
//
"html",
"css",
"postcss",
"scss",
"vue",
"astro"
],
"stylelint.snippet": [
//
"html",
"css",
"postcss",
"scss",
"vue",
"astro"
]
// …
}
```
Expand Down Expand Up @@ -433,7 +445,9 @@ In your `settings.json`:
}
```

### Project settings boilerplate
<!-- NOTE: Too specific, but can be nice to reference some tricks -->

<!-- ### Project settings boilerplate
In your `tsconfig.json`:
Expand Down Expand Up @@ -464,7 +478,7 @@ In your `tsconfig.json`:
}
}
}
```
``` -->

## VSCode

Expand Down
4 changes: 4 additions & 0 deletions configs/eslint-lit.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ module.exports = {
'plugin:lit/recommended',
'plugin:lit-a11y/recommended',
],

rules: {
'class-methods-use-this': ['error', { exceptMethods: ['render'] }],
},
};
3 changes: 1 addition & 2 deletions configs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
],
"license": "ISC",
"devDependencies": {
"@types/node": "^18.7.6",
"prettier-plugin-astro": "0.5.0"
"@types/node": "^18.7.6"
}
}
158 changes: 0 additions & 158 deletions configs/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion configs/prettier-base.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
useTabs: false,
useTabs: true,
};

// {
Expand Down
Loading

0 comments on commit 15e9dc0

Please sign in to comment.