Skip to content

Commit

Permalink
feature: create extendable eslint config (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbodeantor committed Jan 30, 2024
2 parents 0650150 + d46c689 commit 24233e5
Show file tree
Hide file tree
Showing 15 changed files with 1,446 additions and 429 deletions.
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',
},
};

0 comments on commit 24233e5

Please sign in to comment.