1
1
mirror of https://github.com/go-gitea/gitea synced 2025-02-24 14:02:34 +00:00

Enable eslint for commonjs (#33575)

This commit is contained in:
silverwind 2025-02-12 23:47:54 +01:00 committed by GitHub
parent e741448a14
commit 3e39583bb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 8 deletions

View File

@ -1,4 +1,4 @@
const vitestPlugin = require("@vitest/eslint-plugin"); const vitestPlugin = require('@vitest/eslint-plugin');
const restrictedSyntax = ['WithStatement', 'ForInStatement', 'LabeledStatement', 'SequenceExpression']; const restrictedSyntax = ['WithStatement', 'ForInStatement', 'LabeledStatement', 'SequenceExpression'];
module.exports = { module.exports = {
@ -45,6 +45,13 @@ module.exports = {
node: true, node: true,
}, },
overrides: [ overrides: [
{
files: ['**/*.cjs'],
rules: {
'import-x/no-commonjs': [0],
'@typescript-eslint/no-require-imports': [0],
},
},
{ {
files: ['web_src/**/*'], files: ['web_src/**/*'],
globals: { globals: {
@ -81,7 +88,7 @@ module.exports = {
}, },
{ {
files: ['**/*.test.*', 'web_src/js/test/setup.ts'], files: ['**/*.test.*', 'web_src/js/test/setup.ts'],
plugins: ["@vitest/eslint-plugin"], plugins: ['@vitest/eslint-plugin'],
globals: vitestPlugin.environments.env.globals, globals: vitestPlugin.environments.env.globals,
rules: { rules: {
'@vitest/consistent-test-filename': [0], '@vitest/consistent-test-filename': [0],
@ -161,7 +168,7 @@ module.exports = {
{ {
files: ['tests/e2e/**'], files: ['tests/e2e/**'],
plugins: [ plugins: [
'eslint-plugin-playwright' 'eslint-plugin-playwright',
], ],
extends: [ extends: [
'plugin:playwright/recommended', 'plugin:playwright/recommended',

View File

@ -144,7 +144,7 @@ TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMAN
GO_DIRS := build cmd models modules routers services tests GO_DIRS := build cmd models modules routers services tests
WEB_DIRS := web_src/js web_src/css WEB_DIRS := web_src/js web_src/css
ESLINT_FILES := web_src/js tools *.js *.ts tests/e2e ESLINT_FILES := web_src/js tools *.js *.ts *.cjs tests/e2e
STYLELINT_FILES := web_src/css web_src/js/components/*.vue STYLELINT_FILES := web_src/css web_src/js/components/*.vue
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) templates options/locale/locale_en-US.ini .github $(filter-out CHANGELOG.md, $(wildcard *.go *.js *.md *.yml *.yaml *.toml)) SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) templates options/locale/locale_en-US.ini .github $(filter-out CHANGELOG.md, $(wildcard *.go *.js *.md *.yml *.yaml *.toml))
EDITORCONFIG_FILES := templates .github/workflows options/locale/locale_en-US.ini EDITORCONFIG_FILES := templates .github/workflows options/locale/locale_en-US.ini

View File

@ -1,9 +1,13 @@
{ {
"include": [ "include": [
"*", "${configDir}/.*",
"tests/e2e/**/*", "${configDir}/*",
"tools/**/*", "${configDir}/tests/e2e/**/*",
"web_src/js/**/*", "${configDir}/tests/e2e/**/.*",
"${configDir}/tools/**/*",
"${configDir}/tools/**/.*",
"${configDir}/web_src/js/**/*",
"${configDir}/web_src/js/**/.*",
], ],
"compilerOptions": { "compilerOptions": {
"target": "es2020", "target": "es2020",