c737028dd6
## Summary Moves the custom ESLint rules from `tools/eslint-rules` to `packages/twenty-eslint-rules` for better organization within the monorepo packages structure. ## Changes - Move `eslint-rules` from `tools/` to `packages/twenty-eslint-rules` - Use `loadWorkspaceRules` from `@nx/eslint-plugin` to load custom rules - Update all ESLint configs to use the `twenty/` rule prefix instead of `@nx/workspace-` - Update `project.json`, `jest.config.mjs` with new paths - Update `package.json` workspaces and `nx.json` cache inputs - Update Dockerfile reference ## Technical Details The custom ESLint rules are now loaded using Nx's `loadWorkspaceRules` utility which: - Handles TypeScript transpilation automatically - Allows loading workspace rules from any directory - Provides a cleaner approach than the previous `@nx/workspace-` convention ## Testing - Verified all 17 custom ESLint rules load correctly from the new location - Verified linting works on dependent packages (twenty-front, twenty-server, etc.)
77 lines
1.8 KiB
JavaScript
77 lines
1.8 KiB
JavaScript
import typescriptParser from '@typescript-eslint/parser';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import reactConfig from '../twenty-eslint-rules/eslint.config.react.mjs';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
const config = [
|
|
// Extend shared React configuration
|
|
...reactConfig,
|
|
|
|
// Global ignores
|
|
{
|
|
ignores: [
|
|
'**/node_modules/**',
|
|
'**/mockServiceWorker.js',
|
|
'**/generated*/**',
|
|
'**/build/**',
|
|
'**/coverage/**',
|
|
'**/storybook-static/**',
|
|
'**/*config.js',
|
|
'**/__mocks__/**',
|
|
'src/testing/mock-data/**',
|
|
],
|
|
},
|
|
|
|
// CommonJS files configuration
|
|
{
|
|
files: ['**/*.cjs'],
|
|
languageOptions: {
|
|
globals: {
|
|
process: 'readonly',
|
|
__dirname: 'readonly',
|
|
__filename: 'readonly',
|
|
module: 'readonly',
|
|
require: 'readonly',
|
|
exports: 'writable',
|
|
global: 'readonly',
|
|
Buffer: 'readonly',
|
|
},
|
|
sourceType: 'commonjs',
|
|
},
|
|
},
|
|
|
|
// TypeScript project-specific configuration
|
|
{
|
|
files: ['**/*.{ts,tsx}'],
|
|
languageOptions: {
|
|
parser: typescriptParser,
|
|
parserOptions: {
|
|
project: [
|
|
path.resolve(__dirname, 'tsconfig.dev.json'),
|
|
path.resolve(__dirname, 'tsconfig.storybook.json'),
|
|
path.resolve(__dirname, 'tsconfig.spec.json'),
|
|
],
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
];
|
|
|
|
// Add CI-specific rules if in CI environment
|
|
// eslint-disable-next-line no-undef
|
|
if (process.env.NX_TASK_TARGET_CONFIGURATION === 'ci') {
|
|
config.push({
|
|
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
|
|
rules: {
|
|
'no-console': 'error',
|
|
},
|
|
});
|
|
}
|
|
|
|
export default config;
|