atomspace / eslint-plugin-naming-convention

ESLint plugin to validate identifiers names according to a convention
MIT License
1 stars 0 forks source link

No native classes names in identifiers names #28

Closed constgen closed 4 years ago

constgen commented 5 years ago

Forbid class names in variables. eg varNameArray, varNameObject. Variables should be named varNames if it is a collection of items.

PyTechMike commented 5 years ago

Is this rule forbids using the name of a different class in another, e.g. let someObject = 1 or let anyArray = function() {} ?

constgen commented 5 years ago

No. It disallows using this redundant words for any type of value

constgen commented 5 years ago

Something similar from TypeScript world https://palantir.github.io/tslint/rules/variable-name/

image

PyTechMike commented 5 years ago

How hard is it prohibiting native class names? For example, we got Map and Set prohibited, but will be and prohibited too?

PyTechMike commented 5 years ago

Here is my forbidden classes list:

NaN
undefined
null
Object
Function
Boolean
Symbol
Error
Number
Date
String
RegExp
Array
Map
Set
Promise
Generator

Here is source

PyTechMike commented 5 years ago

@constgen What would you say about my last comment with prohibited classes in identifiers? Is it looking ok, or I'm going the wrong way?

constgen commented 5 years ago

@PyTechMike We definitely need to exclude Error, Date, RegExp