@kununu/eslint-config 7.3.1 → 7.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yml +124 -12
- package/eslint.config.mjs +6 -13
- package/package.json +2 -5
|
@@ -12,19 +12,23 @@ on:
|
|
|
12
12
|
- patch
|
|
13
13
|
- minor
|
|
14
14
|
- major
|
|
15
|
+
issue_comment:
|
|
16
|
+
types: [created]
|
|
15
17
|
|
|
16
18
|
env:
|
|
17
19
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
18
20
|
|
|
21
|
+
permissions:
|
|
22
|
+
id-token: write # Required for OIDC
|
|
23
|
+
contents: write
|
|
24
|
+
pull-requests: write
|
|
25
|
+
|
|
19
26
|
jobs:
|
|
20
27
|
release:
|
|
28
|
+
name: Release
|
|
29
|
+
if: github.event_name == 'workflow_dispatch'
|
|
21
30
|
runs-on: ubuntu-latest
|
|
22
31
|
|
|
23
|
-
permissions:
|
|
24
|
-
id-token: write # Required for OIDC
|
|
25
|
-
contents: write
|
|
26
|
-
pull-requests: write
|
|
27
|
-
|
|
28
32
|
steps:
|
|
29
33
|
- name: Generate GitHub App Token
|
|
30
34
|
id: generate_token
|
|
@@ -40,7 +44,7 @@ jobs:
|
|
|
40
44
|
echo "GH_TOKEN=$(./ghapps)" >> $GITHUB_ENV
|
|
41
45
|
|
|
42
46
|
- name: Checkout Source
|
|
43
|
-
uses: actions/checkout@
|
|
47
|
+
uses: actions/checkout@v7
|
|
44
48
|
with:
|
|
45
49
|
fetch-depth: 0
|
|
46
50
|
token: ${{ env.GH_APPS_TOKEN }}
|
|
@@ -51,10 +55,6 @@ jobs:
|
|
|
51
55
|
node-version-file: '.nvmrc'
|
|
52
56
|
cache: "npm"
|
|
53
57
|
|
|
54
|
-
# Ensure npm 11.5.1 or later is installed
|
|
55
|
-
- name: Update npm
|
|
56
|
-
run: npm install -g npm@latest
|
|
57
|
-
|
|
58
58
|
- name: Setup git
|
|
59
59
|
run: |
|
|
60
60
|
git config user.name "github-actions[bot]"
|
|
@@ -68,9 +68,10 @@ jobs:
|
|
|
68
68
|
run: |
|
|
69
69
|
npm version ${{ github.event.inputs.version }} --git-tag-version false
|
|
70
70
|
|
|
71
|
-
- name:
|
|
71
|
+
- name: Get package.json version
|
|
72
72
|
run: |
|
|
73
|
-
|
|
73
|
+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
|
74
|
+
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
|
|
74
75
|
|
|
75
76
|
- name: Create Release Branch
|
|
76
77
|
run: |
|
|
@@ -159,3 +160,114 @@ jobs:
|
|
|
159
160
|
- name: Create Github Release
|
|
160
161
|
run: |
|
|
161
162
|
gh release create $PACKAGE_VERSION --generate-notes
|
|
163
|
+
|
|
164
|
+
release-beta:
|
|
165
|
+
name: Release Beta version
|
|
166
|
+
# check if the comment comes from a pull request and contains the command `/release-beta`
|
|
167
|
+
if: github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '/release-beta')
|
|
168
|
+
runs-on: ubuntu-latest
|
|
169
|
+
|
|
170
|
+
steps:
|
|
171
|
+
- name: Generate GitHub App Token
|
|
172
|
+
id: generate_token
|
|
173
|
+
env:
|
|
174
|
+
GITHUB_APP_ID: ${{ secrets.GH_APPS_APP_ID }}
|
|
175
|
+
GITHUB_INST_ID: ${{ secrets.GH_APPS_INSTALLATION_ID }}
|
|
176
|
+
GITHUB_KEY_VALUE: ${{ secrets.GH_APPS_PRIVATE_KEY }}
|
|
177
|
+
run: |
|
|
178
|
+
GO_GITHUB_VERSION="1.0.1"
|
|
179
|
+
wget -O ghapps https://github.com/kununu/go-github/releases/download/v${GO_GITHUB_VERSION}/go-github_${GO_GITHUB_VERSION}_linux_amd64 && chmod +x ghapps
|
|
180
|
+
|
|
181
|
+
echo "GH_APPS_TOKEN=$(./ghapps)" >> $GITHUB_ENV
|
|
182
|
+
echo "GH_TOKEN=$(./ghapps)" >> $GITHUB_ENV
|
|
183
|
+
|
|
184
|
+
- name: Checkout Source
|
|
185
|
+
uses: actions/checkout@v7
|
|
186
|
+
with:
|
|
187
|
+
fetch-depth: 0
|
|
188
|
+
token: ${{ env.GH_APPS_TOKEN }}
|
|
189
|
+
|
|
190
|
+
- name: Checkout to PR branch
|
|
191
|
+
run: |
|
|
192
|
+
PR_NUMBER=${{ github.event.issue.number }}
|
|
193
|
+
gh pr checkout $PR_NUMBER
|
|
194
|
+
BRANCH_NAME=$(gh pr view $PR_NUMBER --json headRefName --jq '.headRefName')
|
|
195
|
+
echo "BRANCH_NAME=$BRANCH_NAME" >> "$GITHUB_ENV"
|
|
196
|
+
|
|
197
|
+
- name: Setup Node
|
|
198
|
+
uses: actions/setup-node@v6
|
|
199
|
+
with:
|
|
200
|
+
node-version-file: '.nvmrc'
|
|
201
|
+
cache: "npm"
|
|
202
|
+
|
|
203
|
+
- name: Setup git
|
|
204
|
+
run: |
|
|
205
|
+
git config user.name "github-actions[bot]"
|
|
206
|
+
git config user.email "technik@kununu.com"
|
|
207
|
+
|
|
208
|
+
- name: Install Packages
|
|
209
|
+
run: npm ci
|
|
210
|
+
|
|
211
|
+
- name: Set beta version and publish
|
|
212
|
+
run: |
|
|
213
|
+
# Get the current branch name
|
|
214
|
+
current_branch=${{ env.BRANCH_NAME }}
|
|
215
|
+
echo "Current branch name: $current_branch"
|
|
216
|
+
|
|
217
|
+
# Get the current version from package.json
|
|
218
|
+
current_version=$(npm pkg get version --json | tr -d '"')
|
|
219
|
+
echo "Current package.json version: $current_version"
|
|
220
|
+
|
|
221
|
+
# Check if the current version does not contain beta
|
|
222
|
+
if echo "$current_version" | grep -q "-beta."; then
|
|
223
|
+
# If the current version contains beta,
|
|
224
|
+
# increment the pre-release version
|
|
225
|
+
npm --no-git-tag-version version prerelease -f
|
|
226
|
+
else
|
|
227
|
+
# If the current version does not contain beta,
|
|
228
|
+
# set the pre-release version to beta including the branch name and increment the version
|
|
229
|
+
npm --no-git-tag-version version prepatch --preid=${current_branch}-beta -f
|
|
230
|
+
fi
|
|
231
|
+
|
|
232
|
+
# Publish the package with the beta tag
|
|
233
|
+
npm publish --tag beta
|
|
234
|
+
|
|
235
|
+
- name: Get package.json version
|
|
236
|
+
run: |
|
|
237
|
+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
|
238
|
+
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
|
|
239
|
+
|
|
240
|
+
- name: Commit changes
|
|
241
|
+
run: |
|
|
242
|
+
git add .
|
|
243
|
+
if ! git diff --cached --quiet; then
|
|
244
|
+
git commit -m "Update beta version to ${PACKAGE_VERSION}"
|
|
245
|
+
else
|
|
246
|
+
echo "No changes to commit"
|
|
247
|
+
fi
|
|
248
|
+
git push
|
|
249
|
+
|
|
250
|
+
- name: Create comment in PR
|
|
251
|
+
uses: actions/github-script@v9
|
|
252
|
+
env:
|
|
253
|
+
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
|
|
254
|
+
with:
|
|
255
|
+
script: |
|
|
256
|
+
github.rest.issues.createComment({
|
|
257
|
+
issue_number: context.issue.number,
|
|
258
|
+
owner: context.repo.owner,
|
|
259
|
+
repo: context.repo.repo,
|
|
260
|
+
body: `## New beta version released
|
|
261
|
+
|
|
262
|
+
The new beta version **\`${process.env.PACKAGE_VERSION}\`** of \`@kununu/eslint-config\` has been released.
|
|
263
|
+
|
|
264
|
+
Install the new version in your app
|
|
265
|
+
|
|
266
|
+
\`\`\`
|
|
267
|
+
npm install @kununu/eslint-config@${process.env.PACKAGE_VERSION}
|
|
268
|
+
\`\`\`
|
|
269
|
+
|
|
270
|
+
> [!IMPORTANT]
|
|
271
|
+
>
|
|
272
|
+
> **Don't forget to remove the beta version in the \`package.json\` and \`package-lock.json\` before merging**`
|
|
273
|
+
})
|
package/eslint.config.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import babelParser from '@babel/eslint-parser';
|
|
2
|
-
import babelPlugin from '@babel/eslint-plugin';
|
|
3
1
|
import js from '@eslint/js';
|
|
4
2
|
import stylistic from '@stylistic/eslint-plugin';
|
|
5
3
|
import typescriptParser from '@typescript-eslint/parser';
|
|
@@ -25,8 +23,8 @@ export default defineConfig([
|
|
|
25
23
|
reactPlugin.configs.flat['jsx-runtime'],
|
|
26
24
|
sonarjs.configs.recommended,
|
|
27
25
|
stylistic.configs.recommended,
|
|
28
|
-
// Scope the TypeScript rules to TS files only; .js/.jsx use
|
|
29
|
-
//
|
|
26
|
+
// Scope the TypeScript rules to TS files only; .js/.jsx use ESLint's default
|
|
27
|
+
// parser (Espree) and would otherwise run type-aware rules under the wrong parser.
|
|
30
28
|
...tseslint.configs.recommended.map(config => ({
|
|
31
29
|
...config,
|
|
32
30
|
files: ['**/*.ts', '**/*.tsx'],
|
|
@@ -69,17 +67,12 @@ export default defineConfig([
|
|
|
69
67
|
},
|
|
70
68
|
},
|
|
71
69
|
|
|
70
|
+
// Register .js/.jsx as linted extensions so they run through ESLint's default
|
|
71
|
+
// parser (Espree). ESLint lints .js by default but only picks up .jsx when a
|
|
72
|
+
// config's `files` names it; the global ecmaFeatures.jsx setting below lets
|
|
73
|
+
// Espree parse the JSX.
|
|
72
74
|
{
|
|
73
75
|
files: ['**/*.js', '**/*.jsx'],
|
|
74
|
-
languageOptions: {
|
|
75
|
-
parser: babelParser,
|
|
76
|
-
parserOptions: {
|
|
77
|
-
requireConfigFile: false,
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
plugins: {
|
|
81
|
-
babel: babelPlugin,
|
|
82
|
-
},
|
|
83
76
|
},
|
|
84
77
|
|
|
85
78
|
// Test-only configs. Spread as separate entries so their plugins/rules
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kununu/eslint-config",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.2",
|
|
4
4
|
"description": "kununu's ESLint config",
|
|
5
5
|
"main": "eslint.config.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -30,9 +30,6 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/kununu/eslint-config#readme",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@babel/core": "8.0.1",
|
|
34
|
-
"@babel/eslint-parser": "8.0.1",
|
|
35
|
-
"@babel/eslint-plugin": "8.0.1",
|
|
36
33
|
"@eslint/js": "9.39.4",
|
|
37
34
|
"@stylistic/eslint-plugin": "5.10.0",
|
|
38
35
|
"@typescript-eslint/parser": "8.63.0",
|
|
@@ -50,7 +47,7 @@
|
|
|
50
47
|
"typescript-eslint": "8.63.0"
|
|
51
48
|
},
|
|
52
49
|
"peerDependencies": {
|
|
53
|
-
"typescript": ">=
|
|
50
|
+
"typescript": ">=6.0.0"
|
|
54
51
|
},
|
|
55
52
|
"peerDependenciesMeta": {
|
|
56
53
|
"typescript": {
|