Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

import styling rule #1040

Closed
trodi opened this issue Mar 16, 2016 · 3 comments
Closed

import styling rule #1040

trodi opened this issue Mar 16, 2016 · 3 comments

Comments

@trodi
Copy link

trodi commented Mar 16, 2016

There doesn't appear to be a way to set a style on naming imported modules similar to how you can set the style of variable names. This may be an extension of an existing rule instead of an all together new rule.

If I have the following two imports, I'd like to check to see if they are in camelCase for example.

import * as Q from "q";
import * as Path from "path";

I'd expect the following "Foo" likely not to be affected by the naming convention.

import { Foo } from "foo";

In considering this, I referenced variable-name rule as a comparison.

"variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore"],
@jkillian
Copy link
Contributor

Isn't the format of module names more semantic than syntactic though?

For example:

import * as Cat from "cat";
import * as path from "path";

const myCat = new Cat();
const somePath = path.resolve("some/path");

In other words, wouldn't you name your imported modules based off of how they are used?

@trodi
Copy link
Author

trodi commented Mar 17, 2016

Potentially, though I see value in being able to distinguish a given item was imported instead of created locally. Similar to the value you get from a naming convention distinguishing private members/functions versus public ones (which you might find in a checkstyle rule configuration).

@JoshuaKGoldberg
Copy link
Contributor

@trodi this is covered by tslint-microsoft-contrib's import-name rule. This issue is really a subset of #1142 for determining which rules should be ported over.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants