-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[naming-convention] modifier global - Allow selecting only global variables #2318
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
Comments
Its funny because the description of the
and yet its not able to enforce this rule |
Happy to accept a PR if you want it. |
Maybe the name |
Unless you actually meant "global" as in attached to the window, but then it can't be a "const" (at least in modules) |
This should be relatively easy to do, if anyone wants to try.
|
Just to visualize a use case: random-file.ts // Global variable allowed to be UPPER_CASE.
const MY_VALUE = 42;
export class MyClass {
public myMethod(): void {
// This local const (variable) is NOT allowed.
const ANOTHER_VALUE = 27;
// This is allowed.
const anotherValue = 13;
}
} Yes this is not really "global" But for the file scope. It depends on the build system and use of the files. So, we could name it "global". Since |
…lobal`, and `destructured` modifiers - add selectors `classProperty`, `objectLiteralProperty`, `typeProperty`, `classMethod`, `objectLiteralMethod`, `typeMethod` Fixes #2239 Fixes #2512 Fixes #2318 Fixes #1477 Big update to add a bunch of stuff. I couldn't be bothered splitting this out into separate PRs.
…lobal`, and `destructured` modifiers - add selectors `classProperty`, `objectLiteralProperty`, `typeProperty`, `classMethod`, `objectLiteralMethod`, `typeMethod` Fixes #2239 Fixes #2512 Fixes #2318 Fixes #1477 Big update to add a bunch of stuff. I couldn't be bothered splitting this out into separate PRs. Adds the following modifiers: - `exported` - matches anything that is exported from the module. - `global` - matches a variable/function declared in the top-level scope. - `destructured` - matches a variable declared via an object destructuring pattern (`const {x, ignored: y, z = 2}`). Adds the following selectors (self explanatory - just breaking the selectors up): - `classProperty` - `objectLiteralProperty` - `typeProperty` - `classMethod` - `objectLiteralMethod` - `typeMethod` Converts - `property` to a meta selector for `classProperty`, `objectLiteralProperty`, `typeProperty` - `method` to a meta selector for `classMethod`, `objectLiteralMethod`, `typeMethod`
…lobal`, and `destructured` modifiers - add selectors `classProperty`, `objectLiteralProperty`, `typeProperty`, `classMethod`, `objectLiteralMethod`, `typeMethod` Fixes #2239 Fixes #2512 Fixes #2318 Fixes #1477 Big update to add a bunch of stuff. I couldn't be bothered splitting this out into separate PRs. Adds the following modifiers: - `exported` - matches anything that is exported from the module. - `global` - matches a variable/function declared in the top-level scope. - `destructured` - matches a variable declared via an object destructuring pattern (`const {x, ignored: y, z = 2}`). Adds the following selectors (self explanatory - just breaking the selectors up): - `classProperty` - `objectLiteralProperty` - `typeProperty` - `classMethod` - `objectLiteralMethod` - `typeMethod` Converts - `property` to a meta selector for `classProperty`, `objectLiteralProperty`, `typeProperty` - `method` to a meta selector for `classMethod`, `objectLiteralMethod`, `typeMethod`
…lobal`, and `destructured` Fixes #2239 Fixes #2512 Fixes #2318 Closes #2802 Adds the following modifiers: - `exported` - matches anything that is exported from the module. - `global` - matches a variable/function declared in the top-level scope. - `destructured` - matches a variable declared via an object destructuring pattern (`const {x, ignored: y, z = 2}`).
…lobal`, and `destructured` Fixes #2239 Fixes #2512 Fixes #2318 Closes #2802 Adds the following modifiers: - `exported` - matches anything that is exported from the module. - `global` - matches a variable/function declared in the top-level scope. - `destructured` - matches a variable declared via an object destructuring pattern (`const {x, z = 2}`).
…lobal`, and `destructured` Fixes #2239 Fixes #2512 Fixes #2318 Closes #2802 Adds the following modifiers: - `exported` - matches anything that is exported from the module. - `global` - matches a variable/function declared in the top-level scope. - `destructured` - matches a variable declared via an object destructuring pattern (`const {x, z = 2}`).
…lobal`, and `destructured` (#2808) Fixes #2239 Fixes #2512 Fixes #2318 Closes #2802 Adds the following modifiers: - `exported` - matches anything that is exported from the module. - `global` - matches a variable/function declared in the top-level scope. - `destructured` - matches a variable declared via an object destructuring pattern (`const {x, z = 2}`).
Similar to #2239.
I'd like to be able to do something similar to this, i.e.:
The text was updated successfully, but these errors were encountered: