forked from konveyor/editor-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move repo level config from tackle2-ui (konveyor#15)
Changes: 1. GH actions: - PR template - on PR/push action with 2 jobs: standard prod build and extension deployment using virtual screen - nightly using the same jobs as PR/push action 2. Add CI badges to main README 3. Add linting - rules inherited from VS Code generator and rules from tackle2-ui 4. Add OWNERS file 5. Fix test target - use separate build folder for webpack (out) and for tsc(test_out) 6. Set minimal node and npm versions - enforce them in GH actions via .nvmrc file 7. disable watch flag during webpack builds in prod mode 8. Fix linting errors detected by newly added linters Reference-Url: https://github.com/konveyor/tackle2-ui/tree/release-0.5 --------- Signed-off-by: Radoslaw Szwajkowski <[email protected]>
- Loading branch information
Showing
23 changed files
with
2,305 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!-- | ||
## PR Title Prefix | ||
Every **PR Title** should be prefixed with :text: to indicate its type. | ||
- Breaking change: :warning: (`:warning:`) | ||
- Non-breaking feature: :sparkles: (`:sparkles:`) | ||
- Patch fix: :bug: (`:bug:`) | ||
- Docs: :book: (`:book:`) | ||
- Infra/Tests/Other: :seedling: (`:seedling:`) | ||
- No release note: :ghost: (`:ghost:`) | ||
For example, a pull request containing breaking changes might look like | ||
`:warning: My pull request contains breaking changes`. | ||
Since GitHub supports emoji aliases (ie. `:ghost:`), there is no need to include | ||
the emoji directly in the PR title -- **please use the alias**. It used to be | ||
the case that projects using emojis for PR typing had to include the emoji | ||
directly because GitHub didn't render the alias. Given that `:warning:` is | ||
easy enough to read as text, easy to parse in release tooling, and rendered in | ||
GitHub well, we prefer to standardize on the alias. | ||
For more information, please see the Konveyor | ||
[Versioning Doc](https://github.com/konveyor/release-tools/blob/main/VERSIONING.md). | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: CI (repo level) | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
- "release-*" | ||
|
||
pull_request: | ||
branches: | ||
- "main" | ||
- "release-*" | ||
|
||
workflow_dispatch: | ||
|
||
workflow_call: | ||
|
||
concurrency: | ||
group: ci-repo-${{ github.event_name }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
package-tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check-out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js from .nvmrc | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: "vscode/.nvmrc" | ||
|
||
- name: Cache extension node_modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: vscode/node_modules | ||
key: ${{ runner.os }}-node-${{ hashFiles('vscode/package-lock.json') }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
cd vscode | ||
npm version | ||
npm ci | ||
- name: Lint sources | ||
run: | | ||
cd vscode | ||
npm run lint | ||
- name: Build | ||
run: | | ||
cd vscode | ||
npm run package | ||
vscode-tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check-out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js from .nvmrc | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: "vscode/.nvmrc" | ||
|
||
- name: Cache extension node_modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: vscode/node_modules | ||
key: ${{ runner.os }}-node-${{ hashFiles('vscode/package-lock.json') }} | ||
|
||
- run: | | ||
cd vscode | ||
npm ci | ||
- run: | | ||
cd vscode | ||
xvfb-run -a npm run test | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: Nightly CI (repo level @main) | ||
|
||
on: | ||
schedule: | ||
- cron: "35 5 * * *" # every day @ 5:35am UTC | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
nightly: | ||
uses: ./.github/workflows/ci-repo.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: PR Checks | ||
|
||
on: | ||
pull_request_target: | ||
types: [opened, edited, reopened, synchronize] | ||
|
||
jobs: | ||
verify: | ||
runs-on: ubuntu-latest | ||
name: Verify PR contents | ||
steps: | ||
- name: Check Title | ||
id: verifier | ||
uses: konveyor/release-tools/cmd/verify-pr@main | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Project Owners | ||
|
||
This file specifies the code owners of the project. | ||
|
||
## Our Maintainers | ||
|
||
- David Zager ([djzager](https://github.com/djzager)) | ||
- Ian Bolton ([ibolton336](https://github.com/ibolton336)) | ||
- Scott Dickerson ([sjd78](https://github.com/sjd78)) | ||
- Radoslaw Szwajkowski ([rszwajko](https://github.com/rszwajko)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
root=true | ||
|
||
[*] | ||
# standard prettier behaviors | ||
charset = utf-8 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
# Configurable prettier behaviors | ||
end_of_line = lf | ||
indent_style = space | ||
indent_size = 2 | ||
max_line_length = 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
out | ||
dist | ||
node_modules | ||
test_out | ||
.vscode-test/ | ||
*.vsix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v20.12.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Library, IDE and build locations | ||
**/node_modules/ | ||
**/coverage/ | ||
**/dist/ | ||
**/out/ | ||
.vscode/ | ||
.idea/ | ||
.eslintcache/ | ||
|
||
# | ||
# NOTE: Could ignore anything that eslint will look at since eslint also applies | ||
# prettier. | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** @type {import("prettier").Config} */ | ||
const config = { | ||
// default value used | ||
// trailingComma: "all", | ||
// semi: true, | ||
// singleQuote: false, | ||
|
||
// Values used from .editorconfig: | ||
// - printWidth == max_line_length | ||
// - tabWidth == indent_size | ||
// - useTabs == indent_style | ||
// - endOfLine == end_of_line | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { defineConfig } from '@vscode/test-cli'; | ||
import { defineConfig } from "@vscode/test-cli"; | ||
|
||
export default defineConfig({ | ||
files: 'out/test/**/*.test.js', | ||
files: "test_out/test/**/*.test.js", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,91 @@ | ||
import typescriptEslint from "@typescript-eslint/eslint-plugin"; | ||
import tsParser from "@typescript-eslint/parser"; | ||
import tsEslint from "typescript-eslint"; | ||
import prettierRecommended from "eslint-plugin-prettier/recommended"; | ||
import prettier from "eslint-plugin-prettier"; | ||
import unusedImports from "eslint-plugin-unused-imports"; | ||
import react from "eslint-plugin-react"; | ||
import globals from "globals"; | ||
import eslint from "@eslint/js"; | ||
|
||
export default [{ | ||
files: ["**/*.ts"], | ||
}, { | ||
export default [ | ||
eslint.configs.recommended, | ||
...tsEslint.configs.recommended, | ||
react.configs.flat.recommended, | ||
prettierRecommended, | ||
{ | ||
files: [ | ||
"**/*.js", | ||
"**/*.jsx", | ||
"**/*.cjs", | ||
"**/*.mjs", | ||
"**/*.ts", | ||
"**/*.tsx", | ||
], | ||
}, | ||
{ | ||
plugins: { | ||
"@typescript-eslint": typescriptEslint, | ||
"@typescript-eslint": typescriptEslint, | ||
prettier, | ||
"unused-imports": unusedImports, | ||
react, | ||
}, | ||
|
||
languageOptions: { | ||
parser: tsParser, | ||
ecmaVersion: 2022, | ||
sourceType: "module", | ||
parser: tsParser, | ||
ecmaVersion: 2023, // keep in sync with tsconfig.json | ||
sourceType: "module", | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
globals: { | ||
...globals.es2023, | ||
...globals.node, | ||
myCustomGlobal: "readonly", | ||
}, | ||
}, | ||
|
||
rules: { | ||
"@typescript-eslint/naming-convention": ["warn", { | ||
selector: "import", | ||
format: ["camelCase", "PascalCase"], | ||
}], | ||
"@typescript-eslint/naming-convention": [ | ||
"warn", | ||
{ | ||
selector: "import", | ||
format: ["camelCase", "PascalCase"], | ||
}, | ||
], | ||
|
||
curly: "warn", | ||
eqeqeq: "warn", | ||
"no-throw-literal": "warn", | ||
semi: "warn", | ||
curly: "warn", | ||
eqeqeq: "warn", | ||
"no-throw-literal": "warn", | ||
semi: "warn", | ||
|
||
"prettier/prettier": ["warn"], | ||
"@typescript-eslint/no-unused-vars": [ | ||
"warn", | ||
{ argsIgnorePattern: "^_" }, | ||
], | ||
"unused-imports/no-unused-imports": ["warn"], | ||
"@typescript-eslint/no-explicit-any": "warn", | ||
"react/jsx-key": "warn", | ||
// "react-hooks/rules-of-hooks": "warn", | ||
// "react-hooks/exhaustive-deps": "warn", | ||
"no-extra-boolean-cast": "warn", | ||
"prefer-const": "warn", | ||
"react/no-unknown-property": ["warn"], | ||
}, | ||
|
||
settings: { | ||
react: { version: "detect" }, | ||
}, | ||
}]; | ||
|
||
ignores: [ | ||
// take the place of `.eslintignore` | ||
"dist/", | ||
"out/", | ||
"generated/", | ||
"node_modules/", | ||
], | ||
}, | ||
]; |
Oops, something went wrong.