-
Notifications
You must be signed in to change notification settings - Fork 251
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
maintenance: consistency in variables names #1628
Comments
Great! Please create a PR for this. Just to confirm, the following will be valid variable names: class Foo {
private bar;
}
export const ALL_CAPS_ALLOWED_WHEN_CONST_IS_EXPORTED = 42;
const cammelCaseLocalConst = 43;
function cammelCaseFunction() {}
interface PascalInterface {
}
type PascalType = {
}
enum PascalEnum {
Baz
} The following are invalid: class foo {
private Bar;
}
function PascalCaseFunction() {}
interface cammelCaseInterface {
}
type cammelCaseType = {
}
enum cammelCase {
baz
} |
Looks nice :) I will be able to make PR for that soon. |
@nicojs I have some problems with
Coz I don't have setter: 'Cannot assign to 'textContent' because it is a read-only property' Any idea how to fix that? Should I add setter? If yes, wouldn't that mean it can stay as a public variable? |
What's the problem? Probably // File.ts
/**
* Represents a file within Stryker. Could be a strictly in-memory file.
*/
export default class File {
private innerTextContent: string | undefined;
private readonly innerContent: Buffer;
/**
* Creates a new File to be used within Stryker.
* @param name The full name of the file (inc path)
* @param content The buffered or string content of the file
*/
constructor(public readonly name: string, content: Buffer | string) {
if (typeof content === 'string') {
this.innerContent = Buffer.from(content);
this.innerTextContent = content;
} else {
this.innerContent = content;
}
}
/**
* Gets the underlying content as buffer.
*/
get content(): Buffer {
return this.innerContent;
}
/**
* Gets the underlying content as string using utf8 encoding.
*/
get textContent(): string {
if (!this.innerTextContent ) {
this.innerContent = this.content.toString();
}
return this.innerTextContent ;
}
}
Most definitely not. I want
This results in a |
Another maintenance idea:
One naming convention in variables names.
It may be pretty easy to execute since in #1615 I have added plugin for it.
Options are:
More info: https://github.com/ajafff/tslint-consistent-codestyle/blob/master/docs/naming-convention.md
The text was updated successfully, but these errors were encountered: