Skip to content

Commit 4a478ae

Browse files
committed
Init npm package, install dependencies, configure linter, SonarQube & Actions
1 parent cb28d69 commit 4a478ae

File tree

10 files changed

+4725
-0
lines changed

10 files changed

+4725
-0
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
jobs:
9+
sonarqube:
10+
name: SonarQube
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
16+
- run: npm install
17+
- run: make lint
18+
- run: make test-coverage
19+
- name: SonarQube Scan
20+
uses: SonarSource/sonarqube-scan-action@v5
21+
env:
22+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/node_modules/
2+
coverage

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
; node-options=--no-warnings --experimental-vm-modules

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
lint:
2+
npx eslint .
3+
deps-install:
4+
npm ci
5+
test:
6+
npm test
7+
test-coverage:
8+
npm test -- --coverage

bin/pageloader.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#!/usr/bin/env node

eslint.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import { defineConfig } from 'eslint/config'
4+
import stylistic from '@stylistic/eslint-plugin'
5+
6+
export default defineConfig([
7+
stylistic.configs.recommended,
8+
{
9+
files: ['**/*.{js,mjs,cjs}'],
10+
plugins: { js },
11+
extends: ['js/recommended'],
12+
},
13+
{
14+
files: ['**/__tests__/**/*.js', '**/*.test.js'],
15+
languageOptions: {
16+
globals: {
17+
...globals.node,
18+
...globals.jest,
19+
},
20+
},
21+
},
22+
{ files: ['**/*.{js,mjs,cjs}'], languageOptions: { globals: globals.node } },
23+
])

jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default {
2+
testEnvironment: 'node',
3+
transform: {},
4+
}

0 commit comments

Comments
 (0)