|
| 1 | +const { FlatCompat } = require('@eslint/eslintrc'); |
| 2 | +const nxEslintPlugin = require('@nx/eslint-plugin'); |
| 3 | +const eslintPluginSimpleImportSort = require('eslint-plugin-simple-import-sort'); |
| 4 | +const js = require('@eslint/js'); |
| 5 | +const compat = new FlatCompat({ |
| 6 | + baseDirectory: __dirname, |
| 7 | + recommendedConfig: js.configs.recommended, |
| 8 | +}); |
| 9 | +module.exports = [ |
| 10 | + { |
| 11 | + plugins: { |
| 12 | + '@nx': nxEslintPlugin, |
| 13 | + 'simple-import-sort': eslintPluginSimpleImportSort, |
| 14 | + }, |
| 15 | + }, |
| 16 | + { |
| 17 | + files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'], |
| 18 | + rules: { |
| 19 | + '@nx/dependency-checks': 'error', |
| 20 | + '@nx/enforce-module-boundaries': [ |
| 21 | + 'error', |
| 22 | + { |
| 23 | + enforceBuildableLibDependency: true, |
| 24 | + allow: [], |
| 25 | + depConstraints: [ |
| 26 | + { |
| 27 | + sourceTag: '*', |
| 28 | + onlyDependOnLibsWithTags: ['*'], |
| 29 | + }, |
| 30 | + ], |
| 31 | + }, |
| 32 | + ], |
| 33 | + }, |
| 34 | + }, |
| 35 | + ...compat.config({ extends: ['plugin:@nx/typescript'] }).map((config) => ({ |
| 36 | + ...config, |
| 37 | + files: ['**/*.ts', '**/*.tsx'], |
| 38 | + rules: { |
| 39 | + '@typescript-eslint/no-explicit-any': 'off', |
| 40 | + 'simple-import-sort/imports': 'warn', |
| 41 | + 'simple-import-sort/exports': 'warn', |
| 42 | + }, |
| 43 | + })), |
| 44 | + ...compat.config({ extends: ['plugin:@nx/javascript'] }).map((config) => ({ |
| 45 | + ...config, |
| 46 | + files: ['**/*.js', '**/*.jsx'], |
| 47 | + rules: {}, |
| 48 | + })), |
| 49 | + ...compat.config({ env: { jest: true } }).map((config) => ({ |
| 50 | + ...config, |
| 51 | + files: ['**/*.spec.ts', '**/*.spec.tsx', '**/*.spec.js', '**/*.spec.jsx'], |
| 52 | + rules: {}, |
| 53 | + })), |
| 54 | + ...compat.config({ parser: 'jsonc-eslint-parser' }).map((config) => ({ |
| 55 | + ...config, |
| 56 | + files: ['**/*.json'], |
| 57 | + rules: { |
| 58 | + '@nx/dependency-checks': 'error', |
| 59 | + }, |
| 60 | + })), |
| 61 | +]; |
0 commit comments