-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This PR upgrades ESLint 8 to ESLint 9. * change eslintrc format to flat config * remove .eslintignore, move it to the ignores object * adjust custom plugin accordingly * change to flat config in eslint webpack plugin * upgrade to eslint9 * exclude eslint config from sonarcloud coverage * move mock-store-module to test folder * refactor SonarCloud configuration and github action --------- Co-authored-by: SevenWaysDP <[email protected]>
- Loading branch information
1 parent
dda3247
commit e8dc494
Showing
118 changed files
with
1,788 additions
and
1,543 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -28,22 +28,13 @@ jobs: | |
NODE_OPTIONS: "--unhandled-rejections=warn" | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
distribution: "temurin" | ||
java-version: "17" | ||
- name: SonarCloud upload coverage | ||
uses: SonarSource/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} | ||
with: | ||
args: > | ||
-Dsonar.organization=schulcloud-verbund | ||
-Dsonar.projectKey=hpi-schul-cloud_nuxt-client | ||
-Dsonar.sources=. | ||
-Dsonar.exclusions=src/serverApi/**/*.*,src/fileStorageApi/**/*.*,src/h5pEditorApi/**/*.* | ||
-Dsonar.coverage.exclusions=tests/**/*.*,**/*.unit.ts,**/*.unit.js | ||
-Dsonar.cpd.exclusions=tests/**/*.*,**/*.unit.ts,**/*.unit.js,**/locales/*.ts | ||
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
|
@@ -56,4 +47,4 @@ jobs: | |
- name: npm ci | ||
run: npm ci --prefer-offline --no-audit | ||
- name: npm run lint | ||
run: npm run lint | ||
run: npm run lint |
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
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,142 @@ | ||
const js = require("@eslint/js"); | ||
const pluginVue = require("eslint-plugin-vue"); | ||
const vueTsEslintConfig = require("@vue/eslint-config-typescript"); | ||
const schulcloud = require("./lib/eslint-plugin-schulcloud"); | ||
const eslintPluginPrettierRecommended = require("eslint-plugin-prettier/recommended"); | ||
const globals = require("globals"); | ||
|
||
module.exports = [ | ||
...pluginVue.configs["flat/essential"], | ||
js.configs.recommended, | ||
...vueTsEslintConfig({ | ||
extends: ["recommended"], | ||
supportedScriptLangs: { | ||
ts: true, | ||
|
||
// [!DISCOURAGED] | ||
// Set to `true` to allow plain `<script>` or `<script setup>` blocks. | ||
// This might result-in false positive or negatives in some rules for `.vue` files. | ||
// Note you also need to configure `allowJs: true` and `checkJs: true` | ||
// in corresponding `tsconfig.json` files. | ||
js: true, | ||
}, | ||
}), | ||
eslintPluginPrettierRecommended, | ||
|
||
{ | ||
ignores: [ | ||
".vscode/**", | ||
"node_modules/**", | ||
"**/dist/**", | ||
"src/serverApi/**", | ||
"src/fileStorageApi/**", | ||
"src/h5pEditorApi/**", | ||
], | ||
}, | ||
{ | ||
languageOptions: { | ||
ecmaVersion: "latest", | ||
globals: { | ||
...globals.node, | ||
}, | ||
}, | ||
plugins: { | ||
schulcloud, | ||
}, | ||
rules: { | ||
"@typescript-eslint/ban-ts-comment": "error", | ||
"@typescript-eslint/no-empty-function": "error", | ||
"@typescript-eslint/no-empty-object-type": [ | ||
"error", | ||
{ allowInterfaces: "with-single-extends" }, | ||
], | ||
"@typescript-eslint/no-explicit-any": "warn", | ||
"@typescript-eslint/no-inferrable-types": "error", | ||
"@typescript-eslint/no-require-imports": "warn", | ||
"@typescript-eslint/no-restricted-imports": [ | ||
"warn", | ||
{ | ||
patterns: [ | ||
{ | ||
group: [ | ||
"@data-*/*", | ||
"@feature-*/*", | ||
"@page-*/*", | ||
"@ui-*/*", | ||
"@util-*/*", | ||
], | ||
message: "Do not deep import into a module", | ||
}, | ||
{ | ||
group: ["@/modules/data/*", "*/../data/*", "../**/data/*"], | ||
message: | ||
"Data-Modules have to be imported using the pattern '@data-<name>'", | ||
}, | ||
{ | ||
group: [ | ||
"@/modules/feature/*", | ||
"*/../feature/*", | ||
"../**/feature/*", | ||
], | ||
message: | ||
"Feature-Modules have to be imported using the pattern '@feature-<name>'", | ||
}, | ||
{ | ||
group: ["@/modules/page/*", "*/../page/*", "../**/page/*/*"], | ||
message: | ||
"Page-Modules have to be imported using the pattern '@page-<name>'", | ||
}, | ||
{ | ||
group: ["@/modules/ui/*", "*/../ui/*", "../**/ui/*/*"], | ||
message: | ||
"Ui-Modules have to be imported using the pattern '@ui-<name>'", | ||
}, | ||
{ | ||
group: ["@/modules/util/*", "*/../util/*", "../**/util/*/*"], | ||
message: | ||
"Util-Modules have to be imported using the pattern '@util-<name>'", | ||
}, | ||
], | ||
}, | ||
], | ||
"@typescript-eslint/no-unused-vars": "warn", | ||
"no-console": process.env.NODE_ENV === "production" ? "off" : "warn", | ||
"no-debugger": process.env.NODE_ENV === "production" ? "off" : "warn", | ||
"no-empty": "error", | ||
"no-irregular-whitespace": "error", | ||
"no-prototype-builtins": "error", | ||
"no-undef": "warn", | ||
"no-unused-vars": "off", // disable the base rule for @typescript-eslint/no-unused-vars | ||
"no-useless-escape": "error", | ||
"no-var": "error", | ||
"prefer-const": "error", | ||
"prettier/prettier": "error", | ||
"schulcloud/material-icon-imports": "error", | ||
"vue/html-self-closing": [ | ||
"error", | ||
{ | ||
html: { | ||
void: "always", | ||
}, | ||
}, | ||
], | ||
"vue/multi-word-component-names": "off", // TODO - make a final decision about this rule | ||
"vue/no-mutating-props": "error", | ||
"vue/no-setup-props-reactivity-loss": "error", | ||
"vue/no-useless-template-attributes": "error", | ||
"vue/no-v-html": "error", | ||
"vue/no-v-text-v-html-on-component": "error", | ||
}, | ||
}, | ||
{ | ||
files: ["**/*.unit.{j,t}s?(x)", "tests/**"], | ||
languageOptions: { | ||
globals: { | ||
...globals.jest, | ||
mount: "readonly", | ||
shallowMount: "readonly", | ||
fail: "readonly", | ||
}, | ||
}, | ||
}, | ||
]; |
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
Oops, something went wrong.