-
Notifications
You must be signed in to change notification settings - Fork 4
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 for inner "ui"-submodules #92
Labels
bug
Something isn't working
Comments
КонфигВроде на время тестов тоже 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
}
},
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem: Если внутри сегмента в shared еще раз встречается директория с названием сегмента (как на скрине - "ui"), то ложно положительно линтятся импорты внутренностей
Полагаю, что для всяких
entities/smth/ui/**/lib
будет такая же ошибка(другой вопрос - насколько такое валидно трекать с точки зрения public-api)
Помогло:
shared/ui/Icon/ui
вshared/ui/Icon/icons
Icon/icons
и импортить оттуда(но лайтконфиг тоже тут триггерится на отсутствие реэкспорта, хотя не должен - ведь это внутренняя реализация)
Rules:
public-api
public-api/lite
Version:
0.1.0-beta.5
Reference: @pzyryanov1995
The text was updated successfully, but these errors were encountered: