Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use eslint 9 #9

Draft
wants to merge 30 commits into
base: 1-dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0f6f314
chore(npm): upgrade all deps, remove deprecated dep
fmauNeko Dec 9, 2024
0da7484
chore(config): update own eslint config, prepare for typescript
fmauNeko Dec 9, 2024
148e3e1
refactor(backend): convert all to typescript modules
fmauNeko Dec 16, 2024
5930bbb
refactor(backend): convert configs
fmauNeko Dec 16, 2024
7bb0e45
fix(docurl): fix import.meta.filename missing in node 18
fmauNeko Dec 17, 2024
70a1685
ci(github): add semantic-release and other tooling
fmauNeko Dec 17, 2024
c15f47b
feat(frontend): convert frontend package to ts
fmauNeko Dec 17, 2024
2c1dee5
fix(frontend): remove extraneous tests npm script
fmauNeko Dec 17, 2024
2c07762
ci(turbo): remove task dependency
fmauNeko Dec 17, 2024
3e511f1
test(backend): migrate tests to vitest and typescript
fmauNeko Dec 17, 2024
d80c91a
ci(workflow): do not build before tests
fmauNeko Dec 17, 2024
e435778
ci(release): add eslint-9 as a release branch
fmauNeko Dec 17, 2024
0297387
ci(release): add dependencies on semantic-release plugins
fmauNeko Dec 17, 2024
c99ff8c
ci(release): ignore changelog from linter, don't rebase dev branch yet
fmauNeko Dec 17, 2024
f984fb2
ci(env): disable husky in ci
fmauNeko Dec 17, 2024
c8c7c1f
chore(release): 1.0.0-eslint-9.1 [skip ci]
semantic-release-bot Dec 17, 2024
c8d0d4f
ci(release): fix packages contents, switch to multi-semantic-release
fmauNeko Dec 17, 2024
73fa156
ci(release): add registry url
fmauNeko Dec 18, 2024
d915042
chore(release): 1.0.0-eslint-9.1 [skip ci]
semantic-release-bot Dec 18, 2024
0ee2361
chore(release): 1.0.0-eslint-9.1 [skip ci]
semantic-release-bot Dec 18, 2024
203a452
fix(backend): add missing eslint-config-prettier dep
fmauNeko Dec 18, 2024
6246dfb
chore(release): 1.0.0-eslint-9.2 [skip ci]
semantic-release-bot Dec 18, 2024
6499c63
fix(backend): fix wrong plugin name, fix node config not an array
fmauNeko Dec 18, 2024
9d2d013
chore(release): 1.0.0-eslint-9.3 [skip ci]
semantic-release-bot Dec 18, 2024
df1caa1
fix(backend): work around eslint-config-prettier referring to removed…
fmauNeko Dec 18, 2024
f4dc76b
chore(release): 1.0.0-eslint-9.4 [skip ci]
semantic-release-bot Dec 18, 2024
7f0a981
fix(backend): more workarounds
fmauNeko Dec 18, 2024
70506d3
chore(release): 1.0.0-eslint-9.5 [skip ci]
semantic-release-bot Dec 18, 2024
9821e94
fix(backend): actually fix the issue and stop going down the wrong ra…
fmauNeko Dec 18, 2024
ddd95ca
chore(release): 1.0.0-eslint-9.6 [skip ci]
semantic-release-bot Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
}
3 changes: 3 additions & 0 deletions .cz.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "./node_modules/cz-conventional-changelog"
}
27 changes: 0 additions & 27 deletions .github/workflows/nodejs.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/publish.yml

This file was deleted.

86 changes: 86 additions & 0 deletions .github/workflows/push-and-pr.workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Push and PR

on:
push:
branches:
- master
- beta
- '[0-9]+-dev'
- eslint-9
pull_request:

env:
HUSKY: 0

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: ${{ matrix.node-version }}

- run: npm ci
- run: npm run lint

functional-tests:
name: Functional Tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: ${{ matrix.node-version }}

- run: npm ci
- run: npm run test

release:
name: Release process
if: ${{ github.event_name == 'push' && (github.ref_name == 'master' || github.ref_name == 'beta' || github.ref_name == 'eslint-9') }}
needs: [lint, functional-tests]
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
packages: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: 22.x
registry-url: 'https://registry.npmjs.org'

- run: npm ci
- run: npm run build

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
SEMANTIC_RELEASE_NPM_PUBLISH: 'true'
SEMANTIC_RELEASE_SLACK_WEBHOOK: ${{ secrets.SEMANTIC_RELEASE_SLACK_WEBHOOK }}
run: npx multi-semantic-release

# - name: Rebase dev branch (keep linear history)
# if: ${{ github.ref != 'refs/heads/1-dev' }}
# run: |
# git fetch --no-tags origin 1-dev:1-dev
# git rebase ${GITHUB_REF_NAME} 1-dev
# git push origin 1-dev
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
.turbo
dist
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/.bin/commitlint --edit
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/.bin/lint-staged
15 changes: 15 additions & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
COMMIT_SOURCE=$2

# Ignore "merge | amend | fixup"
# commit = amend
# message = fixup
if [ "${COMMIT_SOURCE}" == merge ] || [ "${COMMIT_SOURCE}" == commit ] || [ "${COMMIT_SOURCE}" == message ]
then
exit 0
fi

# Check if is called by a terminal because VScode haven't access to tty and cause an error
if [ -t 1 ]
then
exec < /dev/tty && node_modules/.bin/cz --hook || true
fi
3 changes: 3 additions & 0 deletions .lintstagedrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'*.md': 'prettier --list-different',
};
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGELOG.md
14 changes: 14 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": ["semantic-release-config-kuzzle"],
"branches": [
"master",
{
"name": "beta",
"prerelease": true
},
{
"name": "eslint-9",
"prerelease": true
}
]
}
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 1.0.0-eslint-9.1 (2024-12-17)


### Bug Fixes

* **backend:** correct keyword for warning rules ([370feb6](https://github.com/kuzzleio/eslint-plugin-kuzzle/commit/370feb68da9fdec618e71184e93e7aa8fe18bd35))
* **docurl:** fix import.meta.filename missing in node 18 ([7bb0e45](https://github.com/kuzzleio/eslint-plugin-kuzzle/commit/7bb0e45723e1b8e2824b03849cb069456b41a920))
* **frontend:** remove extraneous tests npm script ([2c1dee5](https://github.com/kuzzleio/eslint-plugin-kuzzle/commit/2c1dee5698b9d94da28f6fa34121dc9e59de0cf1))


### Features

* add eslint jest plugin for tests ([96b1ee8](https://github.com/kuzzleio/eslint-plugin-kuzzle/commit/96b1ee865b6d32e618a8c644b72616f0aa3fe22e))
* add Vue.js config package ([2a072a5](https://github.com/kuzzleio/eslint-plugin-kuzzle/commit/2a072a51c8c91ef25d80f15f7633222d5858ff36))
* **frontend:** convert frontend package to ts ([c15f47b](https://github.com/kuzzleio/eslint-plugin-kuzzle/commit/c15f47ba966d89fdf14efd9da30a47dac5c19a83))
* **typescript:** add project configuration ([3992e17](https://github.com/kuzzleio/eslint-plugin-kuzzle/commit/3992e173301494713b98ee3eec99cd4406094cb0))
* update typescript ([468deea](https://github.com/kuzzleio/eslint-plugin-kuzzle/commit/468deea45b587effebd5a77cec46f1f95d685984))
44 changes: 44 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import eslint from '@eslint/js';
import eslintPlugin from 'eslint-plugin-eslint-plugin';
import nodePlugin from 'eslint-plugin-n';
import prettierPluginRecommended from 'eslint-plugin-prettier/recommended';
import globals from 'globals';
import tseslint from 'typescript-eslint';

export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.recommended,
nodePlugin.configs['flat/recommended'],
eslintPlugin.configs['flat/recommended'],
{
rules: {
'n/file-extension-in-import': ['error', 'always'],
'n/no-unpublished-import': [
'error',
{
ignoreTypeImport: true,
},
],
},
},
{
languageOptions: {
globals: {
...globals.nodeBuiltin,
...globals.es2023,
},
},
},
{
files: ['tests/**/*.js'],
languageOptions: {
globals: {
...globals.mocha,
},
},
},
{
ignores: ['**/dist/'],
},
prettierPluginRecommended,
);
Loading