feature-sliced / eslint-config

🍰 Lint feature-sliced concepts by existing eslint plugins
https://npmjs.com/@feature-sliced/eslint-config
MIT License
112 stars 4 forks source link

LINT: (Beta) [public-api] Falsy positive linting for inner "ui"-submodules #92

Open azinit opened 2 years ago

azinit commented 2 years ago

Problem: Если внутри сегмента в shared еще раз встречается директория с названием сегмента (как на скрине - "ui"), то ложно положительно линтятся импорты внутренностей

Полагаю, что для всяких entities/smth/ui/**/lib будет такая же ошибка (другой вопрос - насколько такое валидно трекать с точки зрения public-api)

Помогло:

Rules: public-api public-api/lite Version: 0.1.0-beta.5 Reference: @pzyryanov1995

image

azinit commented 2 years ago
Конфиг Вроде на время тестов тоже plugin/boundaries отключал он, но тут конфиг должен переопределять по идее ```js 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 } }, } } ```