-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
ref: eslint-plugin-boundaries #92031
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
d83e8a8
1b85c9e
7030cf1
80b488e
8a85327
84c8379
7640f38
26986c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ import pluginQuery from '@tanstack/eslint-plugin-query'; | |
import {globalIgnores} from 'eslint/config'; | ||
import prettier from 'eslint-config-prettier'; | ||
// @ts-expect-error TS(7016): Could not find a declaration file | ||
import boundaries from 'eslint-plugin-boundaries'; | ||
// @ts-expect-error TS(7016): Could not find a declaration file | ||
import importPlugin from 'eslint-plugin-import'; | ||
import jest from 'eslint-plugin-jest'; | ||
import jestDom from 'eslint-plugin-jest-dom'; | ||
|
@@ -977,4 +979,143 @@ export default typescript.config([ | |
'no-restricted-imports': 'off', | ||
}, | ||
}, | ||
{ | ||
name: 'plugin/boundaries', | ||
plugins: { | ||
boundaries, | ||
}, | ||
settings: { | ||
// order matters here in case of nested directories | ||
'boundaries/elements': [ | ||
// --- specifics --- | ||
{ | ||
type: 'devtoolbar', | ||
pattern: 'sentry/components/devtoolbar', | ||
}, | ||
{ | ||
type: 'core-button', | ||
pattern: 'static/app/components/core/button', | ||
}, | ||
{ | ||
type: 'core', | ||
pattern: 'static/app/components/core', | ||
}, | ||
// --- sentry --- | ||
{ | ||
type: 'sentry-images', | ||
pattern: 'static/images', | ||
}, | ||
{ | ||
type: 'sentry-locale', | ||
pattern: '(static/app/locale.tsx|src/sentry/locale/**/*.*)', | ||
mode: 'full', | ||
}, | ||
{ | ||
type: 'sentry-logos', | ||
pattern: 'src/sentry/static/sentry/images/logos', | ||
}, | ||
{ | ||
type: 'sentry-fonts', | ||
pattern: 'static/fonts', | ||
}, | ||
{ | ||
type: 'sentry-fixture', | ||
pattern: 'tests/js/fixtures', | ||
}, | ||
{ | ||
type: 'sentry', | ||
pattern: 'static/app', | ||
}, | ||
// --- getsentry --- | ||
{ | ||
type: 'getsentry', | ||
pattern: 'static/gsApp', | ||
}, | ||
// --- admin --- | ||
{ | ||
type: 'gsAdmin', | ||
pattern: 'static/gsAdmin', | ||
}, | ||
// --- tests --- | ||
{ | ||
type: 'sentry-test', | ||
pattern: 'tests/js/sentry-test', | ||
}, | ||
{ | ||
type: 'getsentry-test', | ||
pattern: 'tests/js/getsentry-test', | ||
}, | ||
{ | ||
type: 'tests', | ||
pattern: 'tests/js', | ||
}, | ||
// --- configs --- | ||
{ | ||
type: 'configs', | ||
pattern: '(package.json|config/**/*.*|*.config.{mjs,js,ts})', | ||
mode: 'full', | ||
}, | ||
{ | ||
type: 'build-utils', | ||
pattern: 'build-utils', | ||
}, | ||
{ | ||
type: 'scripts', | ||
pattern: 'scripts', | ||
}, | ||
], | ||
}, | ||
rules: { | ||
...boundaries.configs.strict.rules, | ||
'boundaries/no-ignored': 'off', | ||
'boundaries/no-private': 'off', | ||
'boundaries/element-types': [ | ||
'warn', | ||
{ | ||
default: 'disallow', | ||
message: '${file.type} is not allowed to import ${dependency.type}', | ||
rules: [ | ||
{ | ||
from: ['sentry*'], | ||
allow: ['core*', 'sentry*'], | ||
Comment on lines
+1102
to
+1103
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So this means: |
||
}, | ||
{ | ||
from: ['sentry-test'], | ||
allow: ['tests'], | ||
}, | ||
{ | ||
from: ['getsentry*'], | ||
allow: ['core*', 'getsentry*', 'sentry*'], | ||
}, | ||
{ | ||
from: ['gsAdmin*'], | ||
disallow: ['sentry-locale'], | ||
allow: ['core*', 'gsAdmin*', 'sentry*', 'getsentry*'], | ||
}, | ||
{ | ||
from: ['devtoolbar'], | ||
allow: ['devtoolbar', 'sentry*'], | ||
}, | ||
{ | ||
from: ['core-button'], | ||
allow: ['core*'], | ||
}, | ||
{ | ||
from: ['tests'], | ||
allow: ['sentry*'], | ||
}, | ||
{ | ||
from: ['configs'], | ||
allow: ['configs', 'build-utils'], | ||
}, | ||
// todo: sentry* shouldn't be allowed | ||
{ | ||
from: ['core'], | ||
allow: ['core*', 'sentry*'], | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: we can remove
core-button
once we’ve isolated everything incore
.core-button
is a separate group now so that we get fewer violations. Since we match withcore*
, both groups are included.