Skip to content

Commit

Permalink
chore: housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
jenssimon committed Aug 6, 2023
1 parent bc0da61 commit 4a1f7ce
Show file tree
Hide file tree
Showing 8 changed files with 986 additions and 1,732 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: CI

on:
push:
branches: [ '**' ]
Expand All @@ -9,12 +8,10 @@ on:
jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3

Expand All @@ -24,10 +21,12 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Test
run: |
yarn
yarn ci-test
- name: Dependencies
run: yarn

- name: Lint
run: yarn lint

release:
needs: [build]
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Jens Simon
Copyright (c) 2023 Jens Simon

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Installation

```sh
$ yarn add @jenssimon/eslint-config-base --dev
yarn add @jenssimon/eslint-config-base --dev
```

## General
Expand All @@ -18,9 +18,10 @@ Additionally:

- line length 120 characters
- no semicolons
- apply rules for eslint comments ([eslint-plugin-eslint-comments](https://github.com/mysticatea/eslint-plugin-eslint-comments#readme))
- apply rules of promises ([eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise#readme)).
- apply SonarJS rules ([eslint-plugin-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs#readme))
- [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn#readme)
- [eslint-plugin-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs#readme)
- [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise#readme)
- [eslint-plugin-eslint-comments](https://github.com/mysticatea/eslint-plugin-eslint-comments#readme)

> **Note**
>
Expand Down Expand Up @@ -89,7 +90,7 @@ Rules for frontend code that typically uses React. Like the standard frontend ru

## License

MIT © 2022 [Jens Simon](https://github.com/jenssimon)
MIT © 2023 [Jens Simon](https://github.com/jenssimon)

[npm-url]: https://www.npmjs.com/package/@jenssimon/eslint-config-base
[npm-image]: https://badgen.net/npm/v/@jenssimon/eslint-config-base
Expand All @@ -98,4 +99,4 @@ MIT © 2022 [Jens Simon](https://github.com/jenssimon)
[gh-url]: https://github.com/jenssimon/eslint-config-base
[gh-stars-image]: https://badgen.net/github/stars/jenssimon/eslint-config-base
[gh-forks-image]: https://badgen.net/github/forks/jenssimon/eslint-config-base
[gh-status-image]: https://badgen.net/github/status/jenssimon/eslint-config-base
[gh-status-image]: https://github.com/jenssimon/eslint-config-base/actions/workflows/ci.yml/badge.svg
21 changes: 13 additions & 8 deletions lib/common.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
module.exports = (config) => ({
module.exports = ({
extends: ext,
plugins,
env,
rules,
overrides,
}) => ({
extends: [
'plugin:import-esm/recommended',
'plugin:eslint-comments/recommended',
'plugin:sonarjs/recommended',
'plugin:unicorn/recommended',
'plugin:promise/recommended',
...config.extends || [],
...ext || [],
],
plugins: [
'promise',
'import',
'optimize-regex',
...config.plugins || [],
...plugins || [],
],
env: config.env,
env,
rules: {
'dot-location': ['error', 'property'],

Expand All @@ -25,8 +31,7 @@ module.exports = (config) => ({
'import/extensions': 'off',
'import/no-unresolved': 'off',
'import/order': [
'error',
{
'error', {
groups: [
'builtin',
'external',
Expand Down Expand Up @@ -74,7 +79,7 @@ module.exports = (config) => ({

semi: ['error', 'never'],

...config.rules || [],
...rules || [],
},
overrides: [
{
Expand All @@ -97,6 +102,6 @@ module.exports = (config) => ({
'jest/prefer-lowercase-title': 'off',
},
},
...config.overrides || [],
...overrides || [],
],
})
18 changes: 12 additions & 6 deletions lib/frontend/common.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
const common = require('../common')

module.exports = (config) => common({
module.exports = ({
env,
plugins,
extends: ext,
rules,
overrides,
}) => common({
env: {
browser: true,
...config.env || [],
...env || [],
},
plugins: [
'babel',
...config.plugins || [],
...plugins || [],
],
extends: [
'plugin:wc/recommended',
...config.extends || [],
...ext || [],
],
rules: {
'babel/no-unused-expressions': 'error',
Expand All @@ -24,7 +30,7 @@ module.exports = (config) => common({

'no-unused-expressions': 'off',

...config.rules || [],
...rules || [],
},
overrides: config.overrides,
overrides,
})
2 changes: 2 additions & 0 deletions lib/frontend/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ module.exports = common({
{
files: [
'**/*.ts',
'**/*.mts',
'**/*.cts',
'**/*.tsx',
],
rules: {
Expand Down
60 changes: 29 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,44 @@
"/lib"
],
"scripts": {
"lint": "eslint --fix --ext .js,.ts,.cjs,.mjs,.cts,.mts ./",
"ci-test": "run-s \"ci-test:*\"",
"ci-test:lint": "eslint ./",
"lint": "eslint --ext .js,.ts,.cjs,.mjs,.cts,.mts ./",
"commit": "cz",
"postinstall": "husky install",
"prepack": "pinst --disable",
"postpack": "pinst --enable",
"semantic-release": "semantic-release"
},
"dependencies": {
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-base": "15.0.0",
"eslint-import-resolver-node": "0.3.8",
"eslint-plugin-babel": "5.3.1",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-import": "2.28.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-import-resolver-node": "^0.3.8",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-import-esm": "^1.2.1",
"eslint-plugin-jest": "27.2.3",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-lit": "1.8.3",
"eslint-plugin-optimize-regex": "1.2.1",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-react": "7.33.1",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-redux": "4.0.0",
"eslint-plugin-sonarjs": "0.20.0",
"eslint-plugin-unicorn": "48.0.1",
"eslint-plugin-wc": "1.5.0"
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-lit": "^1.8.3",
"eslint-plugin-optimize-regex": "^1.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.33.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-redux": "^4.0.0",
"eslint-plugin-sonarjs": "^0.20.0",
"eslint-plugin-unicorn": "^48.0.1",
"eslint-plugin-wc": "^1.5.0"
},
"devDependencies": {
"@commitlint/cli": "17.6.7",
"@commitlint/config-conventional": "17.6.7",
"commitizen": "4.3.0",
"cz-conventional-changelog": "3.3.0",
"eslint": "8.46.0",
"husky": "8.0.3",
"lint-staged": "13.2.3",
"npm-run-all": "4.1.5",
"pinst": "3.0.0",
"semantic-release": "21.0.7"
"@commitlint/cli": "^17.6.7",
"@commitlint/config-conventional": "^17.6.7",
"commitizen": "^4.3.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.46.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.3",
"npm-run-all": "^4.1.5",
"pinst": "^3.0.0",
"semantic-release": "^21.0.7"
},
"peerDependencies": {
"eslint": "^7.32.0 || ^8.2.0"
Expand All @@ -74,7 +72,7 @@
}
},
"lint-staged": {
"**/*.{js,ts}": "eslint"
"**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}": "eslint"
},
"packageManager": "yarn@3.6.1",
"config": {
Expand Down
Loading

0 comments on commit 4a1f7ce

Please sign in to comment.