Comments (8)
Sure 👍 thanks for the quick discussion. I'll find some time soon to open a PR
from eslint.
Hi @chrisvltn, thanks for the issue.
I think this is a good idea to add regex for no-restricted-exports
rule but according to your specification we can also think about an option that would contain only those export names that are allowed and other will be restricted.
@eslint/eslint-team, should we consider this?
from eslint.
@Tanujkanti4441 great idea. A rule to allow only certain named exports would also fit well to solve the problem :)
from eslint.
I don't feel strongly either way, but if we do make this change, I think we should match how regexes are defined in no-restricted-imports
.
from eslint.
+1 in general to this request and keeping consistent with equivalent rules. Especially when there's already mirroring in the rule name: e.g. no-restricted-(exports|imports)
.
For specifically mirroring no-restricted-imports
, is there a need to mirror paths
? I'd think everything would be doable with patterns
that use ^
and/or $
to delineate full matchers.
from eslint.
I don't see much similarity between these two rules, despite the similar names.
no-restricted-imports
is about disallowing the use of existing modules by specifying string paths
or .gitignore-style patterns
that match the import source (e.g., "mod"
in import { foo } from "mod"
). Optionally, only certain names (foo
) can be disallowed by additionally specifying importNames
or importNamePattern
.
no-restricted-exports
is about naming new exports. There's no import source to which paths
/patterns
would correspond.
We could add an option restrictedNamedExportsPattern
(a string that will be used as a regex pattern)?
from eslint.
We could add an option
restrictedNamedExportsPattern
(a string that will be used as a regex pattern)?
I suppose that does go along with the existing restrictedNamedExports
option. 👍
Marking as accepted.
@chrisvltn would you like to submit a pull request?
from eslint.
Closed by #18431
from eslint.
Related Issues (20)
- Rule Change: provide an option to turn off counting of optional chaining for complexity HOT 1
- ESLint 9.2.0 reports "is defined but never used" when used with eslint-plugin-react package. HOT 2
- Rule Change: Should `no-magic-numbers` be moved out of core HOT 2
- Bug: object-shorthand auto-fix removes comments HOT 3
- Bug: Flat config ignores option dont work HOT 1
- Change Request: New eslint cli option HOT 1
- ESLint hangs indefinitely, no errors HOT 4
- Docs: no-restricted-imports HOT 5
- Change Request: `release-please` should create release only for certain tags HOT 5
- Change Request: Add feature flag capabilities to ESLint HOT 9
- Bug: can't run a single ESLint rule in CLI after migrating to flat config HOT 7
- Rule Change: Suggestion fixer for `prefer-destructuring` HOT 3
- Docs: Give example for adding meta.name and meta.version to plugin config HOT 6
- Bug: Imports fail in flat config file when ESLint installed elsewhere HOT 3
- Bug: cannot select node within init script
- Issue: pattern is being ignored
- Docs: func-style docs are confusing HOT 1
- Docs: Unexpected file matching behavior when using `ignores` without `files` HOT 12
- Bug: No files matching the pattern "linebreak-style: [2, windows]" were found. HOT 3
- Change Request: Add autofix for func-style HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint.