Skip to content

Commit 2c04561

Browse files
committed
chore: initial empty scaffold project
init step for podman-desktop/podman-desktop#8972 Change-Id: Ie39624fa2bb98774a44cdfab0897327cd7b1b63e Signed-off-by: Florent Benoit <[email protected]> Change-Id: Ic9673b19f3db38e668659f5f68e5425753c16f23
1 parent daf1b5a commit 2c04561

25 files changed

+9190
-0
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/workflows/pr-check.yaml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#
2+
# Copyright (C) 2024 Red Hat, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# SPDX-License-Identifier: Apache-2.0
17+
18+
name: pr-check
19+
20+
on: [pull_request]
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
lint-format-unit:
28+
name: build, linter, formatters and unit tests / ${{ matrix.os }}
29+
runs-on: ${{ matrix.os }}
30+
timeout-minutes: 40
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
os: [windows-2022, ubuntu-24.04, macos-15]
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- uses: pnpm/action-setup@v4
39+
name: Install pnpm
40+
with:
41+
run_install: false
42+
43+
- uses: actions/setup-node@v4
44+
with:
45+
node-version: 20
46+
cache: 'pnpm'
47+
48+
- name: Execute pnpm
49+
run: pnpm install
50+
51+
- name: Execute pnpm build
52+
run: pnpm build
53+
54+
- name: Run linter
55+
run: pnpm lint:check
56+
57+
- name: Run formatter
58+
run: pnpm format:check
59+
60+
- name: Run unit tests
61+
run: pnpm test:unit
62+
63+
- name: Run typecheck
64+
run: pnpm typecheck
65+
66+
- name: Run svelte check
67+
run: pnpm svelte:check
68+
69+
# Check we don't have changes in git
70+
- name: Check no changes in git
71+
if: ${{ matrix.os=='ubuntu-24.04'}}
72+
run: |
73+
if ! git diff --exit-code; then
74+
echo "Found changes in git"
75+
exit 1
76+
fi

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
/.svelte-kit
5+
/.eslintcache
6+
/coverage
7+
.env
8+
.env.*
9+
!.env.example
10+
vite.config.js.timestamp-*
11+
vite.config.ts.timestamp-*

.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node-linker=hoisted
2+

biome.jsonc

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"formatter": {
3+
"indentStyle": "space",
4+
"lineWidth": 120,
5+
"attributePosition": "auto"
6+
},
7+
"files": {
8+
"maxSize": 1600000,
9+
"ignore": ["**/coverage/**", "**/dist/**", "**/.svelte-kit/**"]
10+
},
11+
"javascript": {
12+
"formatter": {
13+
"arrowParentheses": "asNeeded",
14+
"bracketSameLine": true,
15+
"attributePosition": "auto",
16+
"quoteStyle": "single"
17+
}
18+
},
19+
"json": {
20+
"formatter": {
21+
"indentWidth": 2
22+
}
23+
},
24+
"css": {
25+
"formatter": {
26+
"quoteStyle": "single"
27+
}
28+
},
29+
"linter": {
30+
"enabled": true
31+
},
32+
"organizeImports": {
33+
"enabled": false
34+
}
35+
}

eslint.config.mjs

+234
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
/**********************************************************************
2+
* Copyright (C) 2024 Red Hat, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* SPDX-License-Identifier: Apache-2.0
17+
***********************************************************************/
18+
19+
import path from 'node:path';
20+
import { fileURLToPath } from 'node:url';
21+
22+
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
23+
import { FlatCompat } from '@eslint/eslintrc';
24+
import js from '@eslint/js';
25+
import tsParser from '@typescript-eslint/parser';
26+
import vitest from '@vitest/eslint-plugin';
27+
import etc from 'eslint-plugin-etc';
28+
import fileProgress from 'eslint-plugin-file-progress';
29+
import importPlugin from 'eslint-plugin-import';
30+
import noNull from 'eslint-plugin-no-null';
31+
import redundantUndefined from 'eslint-plugin-redundant-undefined';
32+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
33+
import sonarjs from 'eslint-plugin-sonarjs';
34+
import svelte from 'eslint-plugin-svelte';
35+
import unicorn from 'eslint-plugin-unicorn';
36+
import globals from 'globals';
37+
import svelteParser from 'svelte-eslint-parser';
38+
import typescriptLint from 'typescript-eslint';
39+
40+
const __filename = fileURLToPath(import.meta.url);
41+
const __dirname = path.dirname(__filename);
42+
const compat = new FlatCompat({
43+
baseDirectory: __dirname,
44+
recommendedConfig: js.configs.recommended,
45+
allConfig: js.configs.all,
46+
});
47+
48+
export default [
49+
{
50+
ignores: ['**/dist/**/*', '**/.svelte-kit/**', '**/coverage/**', '**/node_modules/**'],
51+
},
52+
js.configs.recommended,
53+
...typescriptLint.configs.recommended,
54+
sonarjs.configs.recommended,
55+
...svelte.configs['flat/recommended'],
56+
...fixupConfigRules(
57+
compat.extends('plugin:import/recommended', 'plugin:import/typescript', 'plugin:etc/recommended'),
58+
),
59+
{
60+
plugins: {
61+
// compliant v9 plug-ins
62+
unicorn,
63+
'file-progress': fileProgress,
64+
// non-compliant v9 plug-ins
65+
etc: fixupPluginRules(etc),
66+
import: fixupPluginRules(importPlugin),
67+
'no-null': fixupPluginRules(noNull),
68+
'redundant-undefined': fixupPluginRules(redundantUndefined),
69+
'simple-import-sort': fixupPluginRules(simpleImportSort),
70+
vitest,
71+
},
72+
settings: {
73+
'import/resolver': {
74+
typescript: true,
75+
node: true,
76+
77+
'eslint-import-resolver-custom-alias': {
78+
alias: {
79+
'/@': './src',
80+
'/@gen': './src-generated',
81+
},
82+
extensions: ['.ts', '.svelte'],
83+
},
84+
},
85+
'file-progress/activate': {
86+
progress: {
87+
hide: false,
88+
successMessage: 'Lint done...',
89+
},
90+
},
91+
},
92+
},
93+
{
94+
linterOptions: {
95+
reportUnusedDisableDirectives: 'off',
96+
},
97+
languageOptions: {
98+
globals: {
99+
...Object.fromEntries(Object.entries(globals.node).map(([key]) => [key, 'off'])),
100+
...globals.browser,
101+
},
102+
// parser: tsParser,
103+
sourceType: 'module',
104+
parserOptions: {
105+
extraFileExtensions: ['.svelte'],
106+
warnOnUnsupportedTypeScriptVersion: false,
107+
project: ['./tsconfig.json', './tsconfig.node.json'],
108+
tsconfigRootDir: __dirname,
109+
},
110+
},
111+
},
112+
{
113+
rules: {
114+
'vitest/no-import-node-test': 'error',
115+
'vitest/no-identical-title': 'error',
116+
eqeqeq: 'error',
117+
'prefer-promise-reject-errors': 'error',
118+
semi: ['error', 'always'],
119+
'comma-dangle': ['warn', 'always-multiline'],
120+
121+
quotes: [
122+
'error',
123+
'single',
124+
{
125+
allowTemplateLiterals: true,
126+
},
127+
],
128+
129+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', caughtErrors: 'none' }],
130+
'@typescript-eslint/no-var-requires': 'off',
131+
'@typescript-eslint/consistent-type-imports': 'error',
132+
'@typescript-eslint/no-explicit-any': 'error',
133+
'@typescript-eslint/await-thenable': 'error',
134+
'@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: false }],
135+
'@typescript-eslint/no-misused-promises': 'error',
136+
'@typescript-eslint/prefer-optional-chain': 'error',
137+
'@typescript-eslint/explicit-function-return-type': 'error',
138+
'@typescript-eslint/prefer-nullish-coalescing': [
139+
'error',
140+
{
141+
ignoreConditionalTests: true,
142+
},
143+
],
144+
'@typescript-eslint/no-require-imports': 'off',
145+
146+
'file-progress/activate': 'warn',
147+
148+
// disabled import/namespace rule as the plug-in is not fully compatible using the compat mode
149+
'import/namespace': 'off',
150+
'import/no-duplicates': 'error',
151+
'import/no-unresolved': 'off',
152+
'import/default': 'off',
153+
'import/no-named-as-default-member': 'off',
154+
'import/no-named-as-default': 'off',
155+
'import/first': 'error',
156+
'import/newline-after-import': 'error',
157+
'import/no-extraneous-dependencies': 'error',
158+
159+
// unicorn custom rules
160+
'unicorn/prefer-node-protocol': 'error',
161+
162+
// sonarjs custom rules
163+
'sonarjs/cognitive-complexity': 'off',
164+
'sonarjs/no-duplicate-string': 'off',
165+
'sonarjs/no-empty-collection': 'off',
166+
'sonarjs/no-small-switch': 'off',
167+
// redundant with @typescript-eslint/no-unused-vars
168+
'sonarjs/no-ignored-exceptions': 'off',
169+
'sonarjs/no-nested-functions': 'off',
170+
'sonarjs/todo-tag': 'off',
171+
'sonarjs/sonar-max-params': 'off',
172+
'sonarjs/no-nested-conditional': 'off',
173+
'sonarjs/no-empty-function': 'off',
174+
'sonarjs/no-base-to-string': 'off',
175+
'sonarjs/unnecessary-character-escapes': 'off',
176+
'sonarjs/different-types-comparison': 'off',
177+
'sonarjs/new-cap': 'off',
178+
'sonarjs/no-invariant-returns': 'off',
179+
'sonarjs/updated-loop-counter': 'off',
180+
'sonarjs/no-redundant-type-constituents': 'off',
181+
'sonarjs/function-return-type': 'off',
182+
'sonarjs/no-lonely-if': 'off',
183+
'sonarjs/deprecation': 'off',
184+
'sonarjs/use-type-alias': 'off',
185+
186+
// failing with the AST parser
187+
'sonarjs/sonar-no-fallthrough': 'off',
188+
'sonarjs/prefer-enum-initializers': 'off',
189+
190+
// etc custom rules
191+
'etc/no-deprecated': 'off',
192+
// disable this rule as it's not compliant with eslint v9
193+
'etc/no-commented-out-code': 'off',
194+
195+
// redundant-undefined custom rules
196+
'redundant-undefined/redundant-undefined': 'error',
197+
198+
// simple-import-sort custom rules
199+
'simple-import-sort/imports': 'error',
200+
'simple-import-sort/exports': 'error',
201+
},
202+
},
203+
204+
{
205+
files: ['**/*.svelte'],
206+
207+
languageOptions: {
208+
parser: svelteParser,
209+
ecmaVersion: 5,
210+
sourceType: 'script',
211+
parserOptions: {
212+
parser: tsParser,
213+
},
214+
},
215+
216+
rules: {
217+
'@typescript-eslint/no-unused-expressions': 'off',
218+
'unicorn/prefer-node-protocol': 'off',
219+
'sonarjs/no-nested-assignment': 'off',
220+
'sonarjs/no-alphabetical-sort': 'off',
221+
},
222+
},
223+
224+
{
225+
files: ['**/*.spec.ts'],
226+
227+
rules: {
228+
'sonarjs/no-hardcoded-ip': 'off',
229+
'sonarjs/no-clear-text-protocols': 'off',
230+
'sonarjs/slow-regex': 'off',
231+
'sonarjs/publicly-writable-directories': 'off',
232+
},
233+
},
234+
];

0 commit comments

Comments
 (0)