2023-05-03 11:06:20 +02:00
== 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.
2023-05-03 11:06:20 +02:00
=== 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;
----
2023-05-03 11:06:20 +02:00
=== 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;
----
2023-05-03 11:06:20 +02:00
=== Exceptions
2020-06-30 12:48:39 +02:00
2022-02-18 09:47:39 +01: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.
2021-06-02 20:44:38 +02:00
2021-06-03 09:05:38 +02:00
ifdef::env-github,rspecator-view[]
2021-09-20 15:38:42 +02:00
'''
== Implementation Specification
(visible only on this page)
2023-10-16 16:34:38 +02:00
=== Message
Rename this file to "xxx".
2021-09-20 15:38:42 +02:00
2021-06-08 15:52:13 +02:00
'''
2021-06-02 20:44:38 +02:00
== Comments And Links
(visible only on this page)
2023-10-16 16:34:38 +02:00
=== relates to: S3259
=== on 14 Jul 2016, 16:09:25 Ann Campbell wrote:
https://github.com/google/error-prone/blob/master/docs/bugpattern/ClassName.md
2023-06-22 10:38:01 +02:00
2021-06-03 09:05:38 +02:00
endif::env-github,rspecator-view[]