mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 00:08:25 +00:00
feat: encapsulate ESLint configuration in a reusable factory function with an extraSourceFiles option. (#4658)
This commit is contained in:
1 parent
3da4797a63
commit
1f825fa644
1 file changed
+77
-70
+77
-70
@@ -1,77 +1,84 @@
|
||||
// @ts-check
|
||||
import withNuxt from './web-frontend/.nuxt/eslint.config.mjs'
|
||||
import globals from './web-frontend/node_modules/globals/index.js'
|
||||
import vitest from './web-frontend/node_modules/eslint-plugin-vitest/dist/index.mjs'
|
||||
import eslintConfigPrettier from './web-frontend/node_modules/eslint-config-prettier/index.js'
|
||||
import withNuxt from "./web-frontend/.nuxt/eslint.config.mjs";
|
||||
import globals from "./web-frontend/node_modules/globals/index.js";
|
||||
import vitest from "./web-frontend/node_modules/eslint-plugin-vitest/dist/index.mjs";
|
||||
import eslintConfigPrettier from "./web-frontend/node_modules/eslint-config-prettier/index.js";
|
||||
|
||||
export default withNuxt([
|
||||
{
|
||||
ignores: [
|
||||
'**/node_modules/**',
|
||||
'**/.nuxt/**',
|
||||
'**/coverage/**',
|
||||
'**/generated/**',
|
||||
'**/.nuxt-storybook/**',
|
||||
'**/dist/**',
|
||||
'**/.output/**',
|
||||
'**/.storybook/**',
|
||||
'**/vitest.setup.ts',
|
||||
],
|
||||
},
|
||||
eslintConfigPrettier, // deactivate eslint rules that conflict with prettier
|
||||
{
|
||||
files: [
|
||||
'web-frontend/**/*.{js,ts,mjs,mts,jsx,tsx,vue}',
|
||||
'premium/web-frontend/**/*.{js,ts,mjs,mts,jsx,tsx,vue}',
|
||||
'enterprise/web-frontend/**/*.{js,ts,mjs,mts,jsx,tsx,vue}',
|
||||
],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node,
|
||||
// Export factory function for reusability in plugins
|
||||
export const createBaserowConfig = ({ extraSourceFiles = [] } = {}) => {
|
||||
return withNuxt([
|
||||
{
|
||||
ignores: [
|
||||
"**/node_modules/**",
|
||||
"**/.nuxt/**",
|
||||
"**/coverage/**",
|
||||
"**/generated/**",
|
||||
"**/.nuxt-storybook/**",
|
||||
"**/dist/**",
|
||||
"**/.output/**",
|
||||
"**/.storybook/**",
|
||||
"**/vitest.setup.ts",
|
||||
],
|
||||
},
|
||||
eslintConfigPrettier, // deactivate eslint rules that conflict with prettier
|
||||
{
|
||||
files: [
|
||||
"web-frontend/**/*.{js,ts,mjs,mts,jsx,tsx,vue}",
|
||||
"premium/web-frontend/**/*.{js,ts,mjs,mts,jsx,tsx,vue}",
|
||||
"enterprise/web-frontend/**/*.{js,ts,mjs,mts,jsx,tsx,vue}",
|
||||
...extraSourceFiles,
|
||||
],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
"no-console": 0,
|
||||
"vue/no-mutating-props": 0,
|
||||
"import/order": "off",
|
||||
"vue/html-self-closing": "off",
|
||||
"vue/no-unused-components": "warn",
|
||||
"vue/no-use-computed-property-like-method": "off",
|
||||
"vue/multi-word-component-names": "off",
|
||||
"vue/no-reserved-component-names": "off",
|
||||
"import/no-named-as-default-member": "off",
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-dynamic-delete": "off",
|
||||
"no-empty": "off",
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'no-console': 0,
|
||||
'vue/no-mutating-props': 0,
|
||||
'import/order': 'off',
|
||||
'vue/html-self-closing': 'off',
|
||||
'vue/no-unused-components': 'warn',
|
||||
'vue/no-use-computed-property-like-method': 'off',
|
||||
'vue/multi-word-component-names': 'off',
|
||||
'vue/no-reserved-component-names': 'off',
|
||||
'import/no-named-as-default-member': 'off',
|
||||
'no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-dynamic-delete': 'off',
|
||||
'no-empty': 'off',
|
||||
},
|
||||
},
|
||||
// Premium and Enterprise-specific overrides
|
||||
{
|
||||
files: [
|
||||
'premium/web-frontend/**/*.{js,ts,mjs,mts,jsx,tsx,vue}',
|
||||
'enterprise/web-frontend/**/*.{js,ts,mjs,mts,jsx,tsx,vue}',
|
||||
],
|
||||
rules: {
|
||||
'vue/order-in-components': 'off',
|
||||
},
|
||||
},
|
||||
// Test files configuration
|
||||
{
|
||||
files: [
|
||||
'**/*.{test,spec}.{js,ts,jsx,tsx}',
|
||||
'**/__tests__/**/*.{js,ts,jsx,tsx}',
|
||||
],
|
||||
plugins: { vitest },
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...vitest.environments.env.globals,
|
||||
// Plugin specific overrides
|
||||
{
|
||||
files: [
|
||||
"premium/web-frontend/**/*.{js,ts,mjs,mts,jsx,tsx,vue}",
|
||||
"enterprise/web-frontend/**/*.{js,ts,mjs,mts,jsx,tsx,vue}",
|
||||
...extraSourceFiles, // Apply these rules to plugins too
|
||||
],
|
||||
rules: {
|
||||
"vue/order-in-components": "off",
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
...vitest.configs.recommended.rules,
|
||||
// Test files configuration
|
||||
{
|
||||
files: [
|
||||
"**/*.{test,spec}.{js,ts,jsx,tsx}",
|
||||
"**/__tests__/**/*.{js,ts,jsx,tsx}",
|
||||
],
|
||||
plugins: { vitest },
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...vitest.environments.env.globals,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
...vitest.configs.recommended.rules,
|
||||
},
|
||||
},
|
||||
},
|
||||
])
|
||||
]);
|
||||
};
|
||||
|
||||
export default createBaserowConfig();
|
||||
Reference in new issue
Block a user