chore: add eslint and prettier configurations

This commit is contained in:
Corbin Crutchley
2022-09-25 05:51:00 -07:00
parent cb7903d8a5
commit 5d628203d3
6 changed files with 560 additions and 400 deletions

5
.eslintignore Normal file
View File

@@ -0,0 +1,5 @@
dist
node_modules
package-lock.json
*.md
*.min.js

46
.eslintrc.js Normal file
View File

@@ -0,0 +1,46 @@
const tsRules = {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-empty-interface": "off"
}
module.exports = {
env: {
node: true,
browser: true,
},
extends: ['eslint:recommended', 'plugin:astro/recommended'],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
"no-unused-vars": "off"
},
overrides: [
{
files: ['*.astro'],
parser: 'astro-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.astro'],
},
rules: {
...tsRules
},
},
{
files: ['*.ts'],
parser: '@typescript-eslint/parser',
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
...tsRules
},
},
{
// Define the configuration for `<script>` tag.
// Script in `<script>` is assigned a virtual file name with the `.js` extension.
files: ['**/*.astro/*.js', '*.astro/*.js'],
parser: '@typescript-eslint/parser',
},
],
};

5
.prettierignore Normal file
View File

@@ -0,0 +1,5 @@
dist
node_modules
package-lock.json
*.md
*.min.js

11
.prettierrc Normal file
View File

@@ -0,0 +1,11 @@
{
"useTabs": true,
"overrides": [
{
"files": ["**/*.astro"],
"options": {
"parser": "astro"
}
}
]
}

883
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -23,7 +23,9 @@
"start": "astro dev --experimental-integrations", "start": "astro dev --experimental-integrations",
"build": "astro build --experimental-integrations", "build": "astro build --experimental-integrations",
"preview": "astro preview --experimental-integrations", "preview": "astro preview --experimental-integrations",
"host:local": "cd dist && ws --http2 --compress" "host:local": "cd dist && ws --http2 --compress",
"format": "prettier -w . --cache --plugin-search-dir=.",
"lint": "eslint . --ext .js,.ts,.astro"
}, },
"devDependencies": { "devDependencies": {
"@astrojs/image": "^0.7.1", "@astrojs/image": "^0.7.1",
@@ -31,10 +33,14 @@
"@remark-embedder/transformer-oembed": "^3.0.0", "@remark-embedder/transformer-oembed": "^3.0.0",
"@types/classnames": "^2.3.1", "@types/classnames": "^2.3.1",
"@types/node": "^18.7.18", "@types/node": "^18.7.18",
"@typescript-eslint/parser": "^4.33.0",
"astro": "^1.2.8", "astro": "^1.2.8",
"astro-icon": "^0.7.3", "astro-icon": "^0.7.3",
"classnames": "^2.3.2", "classnames": "^2.3.2",
"dayjs": "^1.11.5", "dayjs": "^1.11.5",
"eslint": "^7.32.0",
"eslint-plugin-astro": "^0.19.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"gatsby-remark-embedder": "^6.0.1", "gatsby-remark-embedder": "^6.0.1",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.3",
"hast": "^1.0.0", "hast": "^1.0.0",
@@ -44,6 +50,8 @@
"hast-util-to-string": "^2.0.0", "hast-util-to-string": "^2.0.0",
"image-size": "^1.0.2", "image-size": "^1.0.2",
"junk": "^4.0.0", "junk": "^4.0.0",
"prettier": "^2.7.1",
"prettier-plugin-astro": "^0.5.4",
"rehype-raw": "^6.1.1", "rehype-raw": "^6.1.1",
"rehype-retext": "^3.0.2", "rehype-retext": "^3.0.2",
"rehype-slug-custom-id": "^1.1.0", "rehype-slug-custom-id": "^1.1.0",