Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LINT: (Beta) [public-api] Falsy positive linting of grouped features #91

Open
azinit opened this issue Feb 7, 2022 · 2 comments
Open
Labels
bug Something isn't working

Comments

@azinit
Copy link
Member

azinit commented Feb 7, 2022

Problem: Ложно положительно триггерится на фичу внутри группы
Rules: public-api public-api/lite
Version: 0.1.0-beta.5
Reference: @pzyryanov1995

Error: module "//frontend/src/features/history-journal/download-journal/index"

Reaching to "@features/history-journal/download-journal" is not allowed (import/no-internal-modules)

image

@azinit
Copy link
Member Author

azinit commented Feb 7, 2022

Для других фич (где нет структурной группировки), проблем таких нет со слов @pzyryanov1995

Тут по делу ругается, и на @features не триггерится, т.к. нет группы промежуточной

image

@azinit
Copy link
Member Author

azinit commented Feb 7, 2022

Конфиг

Вроде на время тестов тоже plugin/boundaries отключал он, но тут конфиг должен переопределять по идее

module.exports = {
  parser: '@typescript-eslint/parser',
  extends: [
    'airbnb',
    'prettier',
    'plugin:@typescript-eslint/recommended',
    'plugin:@typescript-eslint/recommended-requiring-type-checking',
    'plugin:import/errors',
    'plugin:import/warnings',
    'plugin:import/typescript',
    'plugin:boundaries/recommended',
    '@feature-sliced'
    // '@feature-sliced/eslint-config/rules/public-api/lite' (Пробовали и так)
  ],
  // files: ['*.ts', '*.tsx'], // Your TypeScript files extension
  parserOptions: {
    project: ['./tsconfig.json'], // Specify it only for TypeScript files
    tsconfigRootDir: './',
    createDefaultProgram: true
  },
  plugins: [
    '@typescript-eslint',
    'import'
  ],
  env: {
    browser: true,
  },
  rules: {
    semi: [2, 'never'],
    quotes: [2, 'single'],
    'react/forbid-prop-types': [0],
    'object-curly-spacing': ['error', 'never', {'objectsInObjects': true, 'arraysInObjects': true}],
    'react/jsx-filename-extension': [1, {extensions: ['.js', '.tsx'] }],
    'react/jsx-first-prop-new-line': [1, 'multiline'],
    'no-multiple-empty-lines': ['error', {'max': 1, 'maxEOF': 0}],
    'react/prefer-stateless-function': [0],
    'jsx-a11y/anchor-is-valid': [0],
    'indent': ['error', 2],
    // FIX SOME ERROR START
    // explaining https://stackoverflow.com/questions/63818415/react-was-used-before-it-was-defined/64024916#64024916
    'no-use-before-define': 'off',
    '@typescript-eslint/no-use-before-define': ['error'],
    // FIX SOME ERROR END,
    'import/extensions': [
      'error',
      'ignorePackages',
      {
        'js': 'never',
        'jsx': 'never',
        'ts': 'never',
        'tsx': 'never'
      }
    ],
    '@typescript-eslint/restrict-template-expressions': ['error', {'allowNumber': true, 'allowNullish': true}],
    '@typescript-eslint/no-unused-vars': ['error'],
    'import/prefer-default-export': 'off',
    'import/no-extraneous-dependencies': ['error', {'devDependencies': true}],
    // 'import/order': [
    //   'error',
    //   {
    //     'alphabetize': {'order': 'asc', 'caseInsensitive': true},
    //     'newlines-between': 'always',
    //     'pathGroups': [
    //       {'group': 'internal', 'position': 'after', 'pattern': '~/processes/**'},
    //       {'group': 'internal', 'position': 'after', 'pattern': '~/pages/**'},
    //       {'group': 'internal', 'position': 'after', 'pattern': '~/widgets/**'},
    //       {'group': 'internal', 'position': 'after', 'pattern': '~/features/**'},
    //       {'group': 'internal', 'position': 'after', 'pattern': '~/entities/**'},
    //       {'group': 'internal', 'position': 'after', 'pattern': '~/shared/**'}
    //     ],
    //     'pathGroupsExcludedImportTypes': ['builtin'],
    //     'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index']
    //   }
    // ],
    // Reason: https://github.com/reduxjs/redux-toolkit/issues/521
    // Solution: https://redux-toolkit.js.org/usage/immer-reducers#linting-state-mutations
    'no-param-reassign': ['error', {props: true, ignorePropertyModificationsFor: ['state'] }],
    // Reason: https://github.com/microsoft/TypeScript/issues/31247
    // Solution: https://stackoverflow.com/a/64041197
    'react/prop-types': 'off', // Since we do not use prop-types
    'react/require-default-props': 'off', // Since we do not use prop-types
  },
  'overrides': [{'files': ['**/*.test.*'], 'rules': {'boundaries/element-types': 'off'} }],
  settings: {
    'import/resolver': {
      'node': {
        'extensions': [
          '.ts',
          '.tsx'
        ]
      },
      "typescript": {
        "alwaysTryTypes": true
      }
    },
  }
}

@azinit azinit added the bug Something isn't working label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant