2024-01-04 01:07:25 +03:00
|
|
|
module.exports = {
|
|
|
|
root: true,
|
|
|
|
extends: ['plugin:prettier/recommended'],
|
2024-02-25 15:52:48 +03:00
|
|
|
plugins: [
|
|
|
|
'@nx',
|
|
|
|
'prefer-arrow',
|
2024-04-04 13:05:26 +03:00
|
|
|
'import',
|
2024-02-25 15:52:48 +03:00
|
|
|
'simple-import-sort',
|
|
|
|
'unused-imports',
|
|
|
|
'unicorn',
|
|
|
|
],
|
2024-01-04 01:07:25 +03:00
|
|
|
rules: {
|
|
|
|
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
|
|
|
'no-console': ['warn', { allow: ['group', 'groupCollapsed', 'groupEnd'] }],
|
|
|
|
'no-control-regex': 0,
|
2024-04-04 13:05:26 +03:00
|
|
|
'no-duplicate-imports': 'error',
|
2024-01-04 01:07:25 +03:00
|
|
|
'no-undef': 'off',
|
2024-04-04 13:05:26 +03:00
|
|
|
'no-unused-vars': 'off',
|
2024-01-04 01:07:25 +03:00
|
|
|
|
|
|
|
'@nx/enforce-module-boundaries': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
enforceBuildableLibDependency: true,
|
|
|
|
allow: [],
|
|
|
|
depConstraints: [
|
|
|
|
{
|
chore: use Nx affected tasks in CI (#5110)
Closes #5097
- Uses "nx affected" to detect what projects need to be checked in the
current PR (for now, `ci-front` and `ci-server` workflows only).
- Caches results of certain tasks (`lint`, `typecheck`, `test`,
`storybook:build`) when a PR pipeline runs. The next runs of the same
PR's pipeline will then be able to reuse the PR's task cache to execute
tasks faster.
- Caches Yarn's cache folder to install dependencies faster in CI jobs.
- Rewrites the node modules cache/install steps as a custom, reusable
Github action.
- Distributes `ci-front` jobs with a "matrix" strategy.
- Sets common tasks config at the root `nx.json`. For instance, to
activate the `typecheck` task in a project, add `typecheck: {}` to its
`project.json` and it'll use the default config set in `nx.json` for the
`typecheck` task. Options can be overridden in each individual
`project.json` if needed.
- Adds "scope" tags to some projects: `scope:frontend`, `scope:backend`,
`scope:shared`. An eslint rule ensures that `scope:frontend` only
depends on `scope:frontent` or `scope:shared` projects, same for
`scope:backend`. These tags are used by `nx affected` to filter projects
by scope and generates different task cache keys according to the
requested scope.
- Enables checks for twenty-emails in the `ci-server` workflow.
2024-04-30 17:28:25 +03:00
|
|
|
sourceTag: 'scope:shared',
|
|
|
|
onlyDependOnLibsWithTags: ['scope:shared'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
sourceTag: 'scope:backend',
|
|
|
|
onlyDependOnLibsWithTags: ['scope:shared', 'scope:backend'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
sourceTag: 'scope:frontend',
|
|
|
|
onlyDependOnLibsWithTags: ['scope:shared', 'scope:frontend'],
|
2024-01-04 01:07:25 +03:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
2024-04-04 13:05:26 +03:00
|
|
|
'import/no-relative-packages': 'error',
|
|
|
|
'import/no-useless-path-segments': 'error',
|
|
|
|
'import/no-duplicates': ['error', { considerQueryString: true }],
|
|
|
|
|
2024-01-04 01:07:25 +03:00
|
|
|
'prefer-arrow/prefer-arrow-functions': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
disallowPrototype: true,
|
|
|
|
singleReturnOnly: false,
|
|
|
|
classPropertiesAllowed: false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
'simple-import-sort/imports': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
groups: [
|
2024-04-04 16:38:01 +03:00
|
|
|
// Packages
|
2024-01-04 01:07:25 +03:00
|
|
|
['^react', '^@?\\w'],
|
2024-04-04 16:38:01 +03:00
|
|
|
// Internal modules
|
|
|
|
['^(@|~|src|@ui)(/.*|$)'],
|
|
|
|
// Side effect imports
|
2024-01-04 01:07:25 +03:00
|
|
|
['^\\u0000'],
|
2024-04-04 16:38:01 +03:00
|
|
|
// Relative imports
|
2024-01-04 01:07:25 +03:00
|
|
|
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
|
|
|
|
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
|
2024-04-04 16:38:01 +03:00
|
|
|
// CSS imports
|
2024-01-04 01:07:25 +03:00
|
|
|
['^.+\\.?(css)$'],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'simple-import-sort/exports': 'error',
|
|
|
|
|
|
|
|
'unused-imports/no-unused-imports': 'warn',
|
|
|
|
'unused-imports/no-unused-vars': [
|
|
|
|
'warn',
|
|
|
|
{
|
|
|
|
vars: 'all',
|
|
|
|
varsIgnorePattern: '^_',
|
|
|
|
args: 'after-used',
|
|
|
|
argsIgnorePattern: '^_',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
overrides: [
|
|
|
|
{
|
|
|
|
files: ['**/*.ts', '**/*.tsx'],
|
|
|
|
extends: ['plugin:@nx/typescript'],
|
|
|
|
rules: {
|
|
|
|
'@typescript-eslint/ban-ts-comment': 'error',
|
2024-04-04 13:05:26 +03:00
|
|
|
'@typescript-eslint/consistent-type-imports': [
|
|
|
|
'error',
|
|
|
|
{ prefer: 'no-type-imports' },
|
|
|
|
],
|
2024-01-04 01:07:25 +03:00
|
|
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
2024-04-04 13:05:26 +03:00
|
|
|
'@typescript-eslint/interface-name-prefix': 'off',
|
|
|
|
'@typescript-eslint/no-empty-function': 'off',
|
|
|
|
'@typescript-eslint/no-empty-interface': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
allowSingleExtends: true,
|
|
|
|
},
|
|
|
|
],
|
2024-01-04 01:07:25 +03:00
|
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
2024-04-01 14:16:50 +03:00
|
|
|
'@typescript-eslint/no-empty-function': 'off',
|
2024-01-04 01:07:25 +03:00
|
|
|
'@typescript-eslint/no-unused-vars': [
|
|
|
|
'warn',
|
|
|
|
{
|
|
|
|
vars: 'all',
|
|
|
|
varsIgnorePattern: '^_',
|
|
|
|
args: 'after-used',
|
|
|
|
argsIgnorePattern: '^_',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['*.js', '*.jsx'],
|
|
|
|
extends: ['plugin:@nx/javascript'],
|
|
|
|
rules: {},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: ['*.spec.@(ts|tsx|js|jsx)', '*.test.@(ts|tsx|js|jsx)'],
|
|
|
|
env: {
|
|
|
|
jest: true,
|
|
|
|
},
|
2024-04-01 14:16:50 +03:00
|
|
|
rules: {
|
|
|
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
|
|
},
|
|
|
|
},
|
2024-02-25 15:52:48 +03:00
|
|
|
{
|
|
|
|
files: ['**/constants/*.ts', '**/*.constants.ts'],
|
|
|
|
rules: {
|
|
|
|
'@typescript-eslint/naming-convention': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
selector: 'variable',
|
|
|
|
format: ['UPPER_CASE'],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'unicorn/filename-case': [
|
|
|
|
'warn',
|
|
|
|
{
|
|
|
|
cases: {
|
|
|
|
pascalCase: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'@nx/workspace-max-consts-per-file': ['error', { max: 1 }],
|
|
|
|
},
|
|
|
|
},
|
2024-04-04 13:05:26 +03:00
|
|
|
{
|
|
|
|
files: ['*.json'],
|
|
|
|
parser: 'jsonc-eslint-parser',
|
|
|
|
},
|
2024-01-04 01:07:25 +03:00
|
|
|
],
|
|
|
|
};
|