@amedia/eslint-config-svelte
Advanced tools
Comparing version 0.0.0-kragl-20220427170212 to 0.0.0-kragl-20220427195503
{ | ||
"name": "@amedia/eslint-config-svelte", | ||
"version": "0.0.0-kragl-20220427170212", | ||
"version": "0.0.0-kragl-20220427195503", | ||
"description": "ESLint Svelte configuration to be used by developers at Amedia", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
111
README.md
# @amedia/eslint-config-svelte | ||
Common ESLint/Prettier configuration for Svelte that extends [@amedia/eslint-config-base](https://www.npmjs.com/package/@amedia/eslint-config-base). | ||
Common ESLint/Prettier configuration for Svelte | ||
## Install | ||
You need to install this package and it's peer dependencies. You install the package by running: | ||
``` | ||
npm i --save-dev @amedia/eslint-config-svelte | ||
``` | ||
Then, to install the peer dependencies you can use `install-peerdeps` like this: | ||
``` | ||
npx install-peerdeps --dev @amedia/eslint-config-svelte | ||
``` | ||
Or you can do it manually by running: | ||
``` | ||
npm info "@amedia/eslint-config-svelte" peerDependencies | ||
npm install --save-dev @amedia/eslint-config-svelte | ||
``` | ||
## Usage | ||
There are a few ways to include the eslint config in your project. _Make sure you dont have any other settings for eslint or prettier already in your editor workspace or global._ Select one of the options below: | ||
Using `package.json`: | ||
```json | ||
{ | ||
"eslintConfig": { | ||
"extends": ["@amedia/eslint-config-svelte", "plugin:import/recommended"] | ||
} | ||
} | ||
```sh | ||
npm install --save-dev @amedia/eslint-config-svelte eslint eslint-plugin-svelte3 prettier-plugin-svelte | ||
``` | ||
Using `.eslintrc`: | ||
After installing the deps, update your ESLint config file, e.g. | ||
`.eslintrc.js`: | ||
```json | ||
{ | ||
"extends": ["@amedia/eslint-config-svelte", "plugin:import/recommended"] | ||
} | ||
``` | ||
or `.eslintrc.js`: | ||
```js | ||
module.exports = { | ||
extends: ['@amedia/eslint-config-svelte', 'plugin:import/recommended'], | ||
extends: ['@amedia/eslint-config-svelte'], | ||
}; | ||
``` | ||
You also need to set up a prettier config. | ||
### Prettier | ||
This is how you use or extend the `@amedia/eslint-config-svelte` prettier config in your | ||
app. Select one of options below: | ||
Using `package.json`: | ||
```json | ||
{ | ||
"prettier": "@amedia/eslint-config-svelte/prettier.config" | ||
} | ||
``` | ||
Using `.prettierrc`: | ||
``` | ||
"@amedia/eslint-config-svelte/prettier.config" | ||
``` | ||
or `prettier.config.js`: | ||
```js | ||
module.exports = require('@amedia/eslint-config-svelte/prettier.config'); | ||
``` | ||
## Are you using VS Code? | ||
Install these extensions for VS Code: | ||
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) | ||
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) | ||
create a folder `.vscode`, and a file `settings.json` with the following: | ||
``` | ||
{ | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true, | ||
"[yaml]": { | ||
"editor.formatOnSave": false | ||
}, | ||
"[javascript]": { | ||
"editor.detectIndentation": true | ||
}, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
} | ||
} | ||
``` | ||
## Linting scripts | ||
You might want to add these two scripts in you `package.json`. | ||
```json | ||
"scripts": { | ||
"lint": "eslint src assets", | ||
"lint-fix": "eslint --fix src assets" | ||
}, | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1875
20