@bjerk/eslint-config
Advanced tools
Comparing version 4.2.0 to 5.0.0
110
index.js
@@ -1,106 +0,6 @@ | ||
/** | ||
* This eslint config is derived work from @runeh and Indiv AS: | ||
* https://github.com/runeh/typical-fetch/blob/main/.eslintrc.json | ||
*/ | ||
const eslintConfig = { | ||
extends: ['./base', './typescript', './import', 'prettier'], | ||
}; | ||
module.exports = { | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:eslint-comments/recommended', | ||
'plugin:promise/recommended', | ||
'prettier', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint', 'import', 'unicorn'], | ||
rules: { | ||
curly: 'error', | ||
'@typescript-eslint/explicit-module-boundary-types': 'warn', | ||
'@typescript-eslint/member-ordering': 'error', | ||
'@typescript-eslint/no-explicit-any': 'error', | ||
'@typescript-eslint/no-unused-expressions': 'error', | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ | ||
argsIgnorePattern: '^_', | ||
ignoreRestSiblings: true, | ||
caughtErrors: 'all', | ||
}, | ||
], | ||
'@typescript-eslint/prefer-optional-chain': 'error', | ||
'@typescript-eslint/prefer-ts-expect-error': 'error', | ||
eqeqeq: ['error', 'smart'], | ||
'eslint-comments/no-unused-disable': 'error', | ||
'import/no-default-export': 'error', | ||
'import/no-duplicates': 'error', | ||
'import/no-extraneous-dependencies': 'error', | ||
'import/no-unassigned-import': 'error', | ||
'import/order': [ | ||
'error', | ||
{ | ||
alphabetize: { | ||
order: 'asc', | ||
}, | ||
'newlines-between': 'never', | ||
}, | ||
], | ||
'no-console': 'error', | ||
'no-restricted-globals': [ | ||
'error', | ||
'event', | ||
'isNaN', | ||
'location', | ||
'name', | ||
'parseInt', | ||
], | ||
'no-return-await': 'error', | ||
'prefer-arrow-callback': 'error', | ||
quotes: [ | ||
'error', | ||
'single', | ||
{ | ||
avoidEscape: true, | ||
allowTemplateLiterals: false, | ||
}, | ||
], | ||
'sort-imports': [ | ||
'error', | ||
{ | ||
ignoreDeclarationSort: true, | ||
}, | ||
], | ||
'spaced-comment': [ | ||
'error', | ||
'always', | ||
{ | ||
exceptions: ['-', '=', '#__PURE__'], | ||
markers: ['/'], | ||
}, | ||
], | ||
'unicorn/filename-case': [ | ||
'error', | ||
{ | ||
case: 'kebabCase', | ||
}, | ||
], | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['**/*.test.ts'], | ||
rules: { | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-unused-vars': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
quotes: ['error', 'single', { allowTemplateLiterals: true }], | ||
}, | ||
}, | ||
{ | ||
files: 'jest.config.*', | ||
rules: { | ||
'import/no-default-export': 'off', | ||
}, | ||
}, | ||
], | ||
}; | ||
// eslint-disable-next-line no-undef | ||
module.exports = eslintConfig; |
{ | ||
"name": "@bjerk/eslint-config", | ||
"version": "4.2.0", | ||
"repository": "github.com:bjerkio/eslint-config", | ||
"version": "5.0.0", | ||
"license": "Apache-2.0", | ||
"author": "Bjerk AS", | ||
"repository": "github.com:bjerkio/eslint-config", | ||
"main": "index.js", | ||
"prettier": "@simenandre/prettier", | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^5.59.0", | ||
"@typescript-eslint/parser": "^5.59.0", | ||
"eslint": "^8.38.0", | ||
"files": [ | ||
"base.js", | ||
"import.js", | ||
"typescript.js" | ||
], | ||
"peerDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^6.0.0", | ||
"@typescript-eslint/parser": "^6.0.0", | ||
"eslint": "^7.32.0 || ^8.2.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-eslint-comments": "^3.2.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-promise": "^6.1.1", | ||
"eslint-plugin-unicorn": "^47.0.0", | ||
"prettier": "^3.0.0", | ||
"@simenandre/prettier": "4.0.1" | ||
"eslint-plugin-unicorn": "^47.0.0" | ||
}, | ||
"peerDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^5.59.0", | ||
"@typescript-eslint/parser": "^5.59.0", | ||
"eslint": "^7.32.0 || ^8.2.0", | ||
"peerDependenciesMeta": { | ||
"prettier": { | ||
"optional": true | ||
} | ||
}, | ||
"devDependencies": { | ||
"@simenandre/prettier": "^4.1.0", | ||
"@typescript-eslint/eslint-plugin": "^6.0.0", | ||
"@typescript-eslint/parser": "^6.0.0", | ||
"eslint": "^8.38.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-eslint-comments": "^3.2.0", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-promise": "^6.1.1", | ||
"eslint-plugin-unicorn": "^47.0.0", | ||
"prettier": "^3.0.0" | ||
"prettier": "^3.0.0", | ||
"typescript": "^5.1.6" | ||
}, | ||
"engines": { | ||
"node": ">=16" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"packageManager": "pnpm@8.6.7", | ||
"peerDevDependencies": [ | ||
@@ -46,16 +60,10 @@ "@typescript-eslint/eslint-plugin", | ||
], | ||
"peerDependenciesMeta": { | ||
"prettier": { | ||
"optional": true | ||
} | ||
}, | ||
"engines": { | ||
"node": ">=16" | ||
}, | ||
"prettier": "@simenandre/prettier", | ||
"volta": { | ||
"node": "18.16.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
"scripts": { | ||
"format": "prettier --write .", | ||
"lint": "eslint -c index.js --ext .ts,.tsx,.js,.jsx ." | ||
} | ||
} | ||
} |
@@ -1,11 +0,5 @@ | ||
# eslint-config | ||
# bjerk/eslint-config | ||
These are Bjerk's eslint config, used on most of our projects. | ||
A reusable Eslint config built by and maintained by Bjerk. | ||
This is derived work from [runeh](https://github.com/runeh) and Indiv AS: | ||
https://github.com/runeh/typical-fetch/blob/main/.eslintrc.json | ||
We'd **actually** love more users of our config, so if you have ideas on | ||
improvements – please file an issue or pull request! | ||
```shell | ||
@@ -22,4 +16,4 @@ yarn add @bjerk/eslint-config | ||
Or, if you're using [pnpm], you can make it install peer | ||
dependencies automatically: | ||
Or, if you're using [pnpm], you can make it install peer dependencies | ||
automatically: | ||
@@ -42,25 +36,51 @@ ```shell | ||
Tip: We often use this along with `@simenandre/prettier`, a shared Prettier config. | ||
You can also use parts of this configuration if you want to. For example, if you | ||
only want to use our base config, you can do this: | ||
## Migrate from v2? | ||
```json | ||
{ | ||
"extends": "@bjerk/eslint-config/base" | ||
} | ||
``` | ||
We removed `jest`-related rules in v3, essentially making `jest` an optional | ||
dependency. In our experience, we don't necessarily want to use Jest for every | ||
project anymore. Versions below v3 **require** `jest`. | ||
These are the available configs: | ||
Here are the steps to get it working [again]: | ||
- `@bjerk/eslint-config` | ||
- `@bjerk/eslint-config/base` | ||
- `@bjerk/eslint-config/import` | ||
- `@bjerk/eslint-config/typescript` | ||
Run this in your terminal: | ||
**Note**: The main `@bjerk/eslint-config` config includes all the others, but | ||
also `prettier` (and `eslint-config-prettier`). | ||
```shell | ||
yarn add -D eslint-plugin-jest | ||
``` | ||
Tip: We often use this along with `@simenandre/prettier`, a shared Prettier | ||
config. Typically, we recommend letting `prettier` handle all formatting, and | ||
`eslint` handle all linting. | ||
```json | ||
{ | ||
"eslintConfig": { | ||
"extends": ["@bjerk/eslint-config", "plugin:jest/recommended"], | ||
"plugins": ["jest"] | ||
} | ||
} | ||
``` | ||
## Motivation | ||
We want to have a consistent code style, and we want to promote readable and | ||
maintainable code. We also want to avoid bugs and errors, and we want to have a | ||
good developer experience. | ||
This is our take on making that happen with Eslint! | ||
## Contributing | ||
In comparison to many other eslint configurations, we welcome contributions to | ||
this config. If you have any ideas on how to improve it, please open an issue or | ||
a pull request! | ||
This isn't supposed to be a _Bjerk only_ config, but rather a config that | ||
everyone can use. We want to make it as good as possible, and we want to make it | ||
as useful as possible. If you agree with our motivation, we'd love to have you | ||
on board! | ||
## Thanks | ||
This config is inspired by: | ||
- [runeh](https://github.com/runeh/typical-fetch/blob/main/.eslintrc.json) | ||
- [Indiv](https://github.com/indivorg/eslint-config) | ||
Thanks are in order! 🙏 |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
8
178
85
19791
7
2