From 3b6dcd02c3c94356776b06a8e3b6c6cb4ca5aff1 Mon Sep 17 00:00:00 2001 From: sudoer777 Date: Wed, 24 May 2023 15:37:45 -0500 Subject: [PATCH] Add prettier and eslint --- .eslintrc.cjs | 58 +++++++++++++++++++++ .prettierrc.cjs | 15 ++++++ .vscode/extensions.json | 4 +- .vscode/launch.json | 18 +++---- README.md | 1 - astro.config.mjs | 8 +-- bun.lockb | Bin 215440 -> 216127 bytes package.json | 4 +- src/components/Card.astro | 105 +++++++++++++++++++------------------- src/layouts/Layout.astro | 55 +++++++++++--------- tsconfig.json | 4 +- 11 files changed, 176 insertions(+), 96 deletions(-) create mode 100644 .eslintrc.cjs create mode 100644 .prettierrc.cjs diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..45efbaf --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,58 @@ +module.exports = { + // ... + env: { + es2020: true, + node: true, + 'astro/astro': true, + }, + extends: [ + // ... + 'plugin:astro/recommended', + 'prettier', + 'eslint:recommended', + ], + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + }, + // ... + overrides: [ + { + // Define the configuration for `.astro` file. + files: ['*.astro'], + // Allows Astro components to be parsed. + parser: 'astro-eslint-parser', + // Parse the script in `.astro` as TypeScript by adding the following configuration. + // It's the setting you need when using TypeScript. + parserOptions: { + parser: '@typescript-eslint/parser', + extraFileExtensions: ['.astro'], + sourceType: 'module', + }, + rules: { + // override/add rules settings here, such as: + // "astro/no-set-html-directive": "error" + 'astro/no-conflict-set-directives': 'error', + 'astro/no-unused-define-vars-in-style': 'error', + }, + }, + { + files: ['**/*.astro/*.js', '*.astro/*.js'], + env: { + browser: true, + es2020: true, + }, + parserOptions: { + sourceType: 'module', + }, + rules: { + // override/add rules settings here, such as: + // "no-unused-vars": "error" + + // If you are using "prettier/prettier" rule, + // you don't need to format inside