Skip to content

Commit

Permalink
- removed frontend related code from config
Browse files Browse the repository at this point in the history
- updated readme, less steps and fixed install peerdependency script
  • Loading branch information
staaky committed Oct 22, 2022
1 parent 0cd009b commit 298a8f4
Show file tree
Hide file tree
Showing 5 changed files with 3,893 additions and 11,748 deletions.
50 changes: 10 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,24 @@
# eslint-config
# @bedandbreakfasteu/eslint-config

The ESLint configuration for Bedandbreakfast.eu

## Usage

1. Setup your project to use `@bedandbreakfasteu/prettier-config` by [following this README](https://github.com/bedandbreakfasteu/prettier-config#readme).

2. Make sure `@bedandbreakfasteu/eslint-config` is available in your project.

3. Add an `.eslintrc.js` file at the root of your project that extends this config:

```js
module.exports = {
extends: '@bedandbreakfasteu/eslint-config',
};
```

4. Install the required dependencies into your project using:
1. Install this package along with our [prettier-config](https://github.com/bedandbreakfasteu/prettier-config) using:

```bash
(
export PKG=@bedandbreakfasteu/eslint-config;
npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev
)
yarn add --dev @bedandbreakfasteu/eslint-config@bedandbreakfasteu/eslint-config#2.0.0 @bedandbreakfasteu/prettier-config@bedandbreakfasteu/prettier-config#1.0.1
```

This copies the peerDependencies of this project as devDependencies into yours.

On Windows this should work using [Git for Windows](https://gitforwindows.org/).

5. To run ESLint as a pre-commit hook and automatically fix issues add [husky](https://github.com/typicode/husky) and [lint-staged](https://github.com/okonet/lint-staged) using:
2. Install the required devDependencies using:

```bash
npm install husky lint-staged --save-dev
curl -o - https://raw.githubusercontent.com/bedandbreakfasteu/eslint-config/main/package.json \
| jq '{ "peerDependencies" }.peerDependencies' \
| command sed 's/[\{\},]//g ; s/: /@/g' \
| xargs yarn add --dev
```

Then copy the following to your `package.json`:

```json
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"git add"
]
}
```
3. Add `"extends": "@bedandbreakfasteu/eslint-config"` to your `.eslintrc`

That's it, happy coding!
That's it, happy coding!
45 changes: 1 addition & 44 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var prettierConfig = require('@bedandbreakfasteu/prettier-config');
module.exports = {
ignorePatterns: ['lib/**/*.js', 'dist/**/*.js', 'node_modules'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'import', 'eslint-plugin-jsx-a11y', 'prettier'],
plugins: ['@typescript-eslint', 'import', 'prettier'],
extends: [
'airbnb-base',
'eslint:recommended',
Expand All @@ -14,8 +14,6 @@ module.exports = {
'plugin:import/errors',
'plugin:import/typescript',
'plugin:import/warnings',
'plugin:jsx-a11y/recommended',
'plugin:react/recommended',
'plugin:prettier/recommended',
],
rules: {
Expand All @@ -24,17 +22,6 @@ module.exports = {
'prettier/prettier': [2, prettierConfig],
'lines-between-class-members': [2, 'always', { exceptAfterSingleLine: true }],
'class-methods-use-this': 0,
'jsx-a11y/no-static-element-interactions': ['warn'],
'jsx-a11y/click-events-have-key-events': ['warn'],
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/402#issuecomment-368305051
'jsx-a11y/anchor-is-valid': [
'warn',
{
components: ['Link'],
specialLink: ['hrefLeft', 'hrefRight'],
aspects: ['invalidHref', 'preferButton'],
},
],
'import/extensions': ['error', 'never'],
'import/prefer-default-export': 0,
'import/no-default-export': 2,
Expand Down Expand Up @@ -63,35 +50,5 @@ module.exports = {
alwaysTryTypes: true,
},
},
react: {
version: 'detect',
},
},
overrides: [
{
files: ['*.spec.{ts,tsx}', '*.spec.{js,jsx}'],
rules: {
'no-unused-expressions': 0,
},
},
{
files: ['*.tsx'],
rules: {
'react/prop-types': 0,
'no-plusplus': 0,
},
},
{
files: ['*.{js,jsx}'],
rules: {
'@typescript-eslint/explicit-function-return-type': 0,
},
},
{
files: ['src/**/*.js'],
rules: {
'@typescript-eslint/no-var-requires': 0,
},
},
],
};
Loading

0 comments on commit 298a8f4

Please sign in to comment.