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

feature: create extendable eslint config #44

Merged
merged 11 commits into from
Jan 30, 2024
Merged
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ node_modules
# don't lint build output (make sure it's set to your correct build folder name)
dist

*.config.*

*config*
*rc.*
30 changes: 30 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
parserOptions: {
parser: "@typescript-eslint/parser",
project: [
"./tsconfig.eslint.json"
],
tsConfigRootDir: "./"
},
extends: [
"@pdap-design-system/eslint-config",
"plugin:@typescript-eslint/recommended",
"@vue/typescript/recommended",
],
plugins: [
"@typescript-eslint",
],
overrides: [
{
"extends": [
"plugin:@typescript-eslint/disable-type-checked"
],
"files": [
"./**/*.js"
]
}
],
rules: {
"@typescript-eslint/indent": "off",
}
}
68 changes: 0 additions & 68 deletions .eslintrc.json

This file was deleted.

11 changes: 9 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"css.validate": false,
"eslint.validate": ["typescript", "javascript", "vue"],
}
"eslint.validate": [
"typescript",
"javascript",
"vue"
],
"editor.codeActionsOnSave": {
"source.eslint.fixAll": "explicit"
},
}
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,21 @@ import 'pdap-design-system/styles';
import { Button, Form } from 'pdap-design-system';
```

4. Optional: Import the tailwind config if you need to use additional tailwind styles.
1. Extend the `es-lint` config, for consistency in linting between client apps:
First `npm install --save-dev @pdap-design-system/eslint-config`, then, in `eslintrc`:

```
{
...,
extends: [
"@pdap-design-system/eslint-config",
...
],
}
```


5. (Optional) Import the tailwind config if you need to use additional tailwind styles.

```
// tailwind.config.js
Expand All @@ -51,7 +65,7 @@ module.exports = {

```

5. If the project is using `TypeScript`, the component props definitions and other types are exposed for import as well.
6. If the project is using `TypeScript`, the component props definitions and other types are exposed for import as well.
_n.b. This can be particularly useful for composing `Form` schemas, where `Input` schema objects are defined differently depending on the `type` of input desired._

```
Expand Down
5 changes: 0 additions & 5 deletions config/index.ts

This file was deleted.

49 changes: 49 additions & 0 deletions eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
module.exports = {
root: true,
parser: 'vue-eslint-parser',
extends: [
'eslint:recommended',
'plugin:vue/vue3-essential',
'plugin:vue/vue3-recommended',
'plugin:vue/strongly-recommended',
'@vue/eslint-config-prettier',
],
env: {
node: true
},
plugins: ['prettier'],
rules: {
'vue/require-default-prop': 'off',
indent: 'off',
'vue/no-reserved-component-names': 'off',
'vue/html-self-closing': [
'error',
{
html: {
void: 'always',
normal: 'always',
component: 'always',
},
svg: 'always',
math: 'always',
},
],
'prettier/prettier': [
'warn',
{
indent: [
'warn',
'tab',
{
SwitchCase: 2,
},
],
tabWidth: 2,
useTabs: true,
singleQuote: true,
quotes: [2, "single", { "avoidEscape": true }]
},
],
'vue/no-multiple-template-root': 'off',
},
};
Loading
Loading