1.0.2 • Published 1 year ago

@kembec/eslint-config-ts-astro-vue v1.0.2

Weekly downloads
-
License
AGPL-3.0 license
Repository
github
Last release
1 year ago

@kembec/eslint-config-ts-astro-vue

Welcome to @kembec/eslint-config-ts-astro-vue! This package provides a personal ESLint configuration tailored for projects using TypeScript, Astro, and Vue. It integrates ESLint and Prettier configurations to help maintain code quality and consistency.

Features

  • Integrates ESLint for TypeScript, Astro, and Vue projects.
  • Includes Prettier configuration for consistent code formatting.
  • Designed for minimal setup.

Installation

Before you begin, ensure you have ESLint and Prettier installed in your project. If not, you can install them with the following command:

npm install --save-dev eslint prettier

Then, install this package along with its peer dependencies:

npm install --save-dev @kembec/eslint-config-ts-astro-vue
npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-vue eslint-plugin-astro prettier-plugin-astro

Note: Replace @kembec/eslint-config-ts-astro-vue with the latest version of the package.

Usage

ESLint Configuration

After installation, create or update your .eslintrc.cjs file in the root of your project to extend the configurations from this package:

module.exports = {
  extends: ['@kembec/eslint-config-ts-astro-vue'],
  parserOptions: {
    project: './tsconfig.json',
  },
};

This setup assumes you have a tsconfig.json at the root of your project. If it's located elsewhere, adjust the path accordingly.

Prettier Configuration

This package includes a Prettier configuration. To use it, create a .prettierrc.js in the root of your project with the following content:

module.exports = require('@kembec/eslint-config-ts-astro-vue/prettier.config');

However, note that @kembec/eslint-config-ts-astro-vue needs to explicitly export a prettier.config.js for this to work. If the package does not include a separate Prettier configuration file, you will need to manually create a .prettierrc.js file and define your Prettier rules within it.

Adding Scripts to package.json

To make linting and formatting easier, you can add the following scripts to your package.json:

"scripts": {
  "lint": "eslint . --ext .js,.ts,.vue,.astro",
  "lint:fix": "eslint --fix . --ext .js,.ts,.vue,.astro",
  "format": "prettier --write \"**/*.{js,ts,vue,astro,css,md}\""
}

Contributing

Feedback and contributions are welcome! Please open an issue or pull request on our GitHub repository.

License

This project is licensed under the AGPL-3.0. See the LICENSE file for more details.