45 lines
953 B
Plaintext
Raw Normal View History

== Why is this an issue?
2020-06-30 12:48:39 +02:00
By convention, a file that exports only one class, function, or constant should be named for that class, function or constant. Anything else may confuse maintainers.
=== Noncompliant code example
2020-06-30 12:48:39 +02:00
2022-02-04 17:28:24 +01:00
[source,javascript]
2020-06-30 12:48:39 +02:00
----
// file path: myclass.js -- Noncompliant
class MyClass {
// ...
}
export default MyClass;
----
=== Compliant solution
2020-06-30 12:48:39 +02:00
2022-02-04 17:28:24 +01:00
[source,javascript]
2020-06-30 12:48:39 +02:00
----
// file path: MyClass.js
class MyClass {
// ...
}
export default MyClass;
----
=== Exceptions
2020-06-30 12:48:39 +02:00
Case, dots ( ``++.++`` ), underscores ( ``++_++`` ) and dashes (``++-++``) are ignored from the name comparison. Postfixes in filenames like ``++.dev++`` in ``++my.class.dev.js++`` are also ignored.
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]