Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.

Commit ffd2e6e

Browse files
authored
Make "builtinLinters": "all" mean all linters, but... (#450)
* Add UnreachableCodeLinter to `'default'` and `'all' ` * Fix lint errors caught by UnreachableCodeLinter * Add PreferLambdasLinter and NoEmptyStatementsLinter to `all` In hhast `'all'` doesn't really mean `all`. Let's fix that. FinalOrAbstractClass and DataProviderTypesLinter are missing. I will add FinalOrAbstractClass in the next commit. * Add FinalOrAbstractClassLinter to `'all'` * Update codegen * Update codegen (again) * $v could not be inferred on hhvm-nightly
1 parent 65d5457 commit ffd2e6e

29 files changed

+101
-78
lines changed

codegen/inferred_relationships.hack

+16-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codegen/syntax/ModuleMembershipDeclaration.hack

+51-56
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codegen/token_from_data.hack

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Linters/ASTLintError.hack

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use type Facebook\HHAST\Node;
1313
use function Facebook\HHAST\find_position;
1414
use namespace HH\Lib\Str;
1515

16+
// HHAST_IGNORE_ERROR[FinalOrAbstractClass] This class is meant to be extended.
1617
class ASTLintError extends SingleRuleLintError {
1718
<<__Override>>
1819
public function __construct(

src/Linters/AsyncFunctionAndMethodLinter.hack

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ namespace Facebook\HHAST;
1111

1212
use namespace HH\Lib\Str;
1313

14+
// HHAST_IGNORE_ERROR[FinalOrAbstractClass] This class declares a protected method
15+
// splitName(), which may be overridden in a child class.
1416
class AsyncFunctionAndMethodLinter extends FunctionNamingLinter {
1517
const type TConfig = shape();
1618

src/Linters/BuiltLintError.hack

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace Facebook\HHAST;
1111

12+
// HHAST_IGNORE_ERROR[FinalOrAbstractClass] This class may be extended elsewhere
1213
class BuiltLintError extends SingleRuleLintError {
1314
private ?(int, int) $position = null;
1415

src/Linters/CamelCasedMethodsUnderscoredFunctionsLinter.hack

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ namespace Facebook\HHAST;
1212
use type Facebook\HHAST\{FunctionDeclaration, MethodishDeclaration};
1313
use namespace HH\Lib\{C, Str};
1414

15+
// HHAST_IGNORE_ERROR[FinalOrAbstractClass] This class declares a protected method
16+
// splitName(), which may be overridden in a child class.
1517
class CamelCasedMethodsUnderscoredFunctionsLinter extends FunctionNamingLinter {
1618
const type TConfig = shape();
1719

src/Linters/LineLintError.hack

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace Facebook\HHAST;
1111

12+
// HHAST_IGNORE_ERROR[FinalOrAbstractClass] This class is meant to be extended.
1213
class LineLintError extends SingleRuleLintError {
1314

1415
public function __construct(

src/Linters/MustUseBracesForControlFlowLinter.hack

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Facebook\HHAST;
1111

1212
use namespace HH\Lib\{Str, Vec};
1313

14-
class MustUseBracesForControlFlowLinter extends AutoFixingASTLinter {
14+
final class MustUseBracesForControlFlowLinter extends AutoFixingASTLinter {
1515
const type TConfig = shape();
1616
const type TNode = IControlFlowStatement;
1717
const type TContext = Script;

src/Linters/NoNewlineAtStartOfControlFlowBlockLinter.hack

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Facebook\HHAST;
1111

1212
use namespace HH\Lib\{C, Vec};
1313

14-
class NoNewlineAtStartOfControlFlowBlockLinter extends AutoFixingASTLinter {
14+
final class NoNewlineAtStartOfControlFlowBlockLinter extends AutoFixingASTLinter {
1515
const type TConfig = shape();
1616
const type TNode = IControlFlowStatement;
1717
const type TContext = Script;

src/Linters/SingleRuleLintError.hack

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace Facebook\HHAST;
1111

1212
use type Facebook\HHAST\File;
1313

14+
// HHAST_IGNORE_ERROR[FinalOrAbstractClass] This class is meant to be extended.
1415
/**
1516
* A problem detected by a SingleRuleLinter
1617
*/

src/Linters/StrictModeOnlyLinter.hack

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Facebook\HHAST;
1111

1212
use namespace HH\Lib\Str;
1313

14-
class StrictModeOnlyLinter extends AutoFixingASTLinter {
14+
final class StrictModeOnlyLinter extends AutoFixingASTLinter {
1515
const type TConfig = shape();
1616
const type TNode = MarkupSuffix;
1717
const type TContext = Script;

src/Migrations/ImplicitShapeSubtypesMigration.hack

-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ final class ImplicitShapeSubtypesMigration extends StepBasedMigration {
7474
->getTrailing(),
7575
),
7676
);
77-
78-
return $shape;
7977
}
8078

8179
<<__Override>>

src/__Private/AsyncQueue.hack

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace Facebook\HHAST\__Private;
1111

12-
class AsyncQueue {
12+
final class AsyncQueue {
1313
private ?Awaitable<mixed> $queue;
1414

1515
public async function enqueueAndWaitForAsync<T>(

src/__Private/LSPLib/ApplyWorkspaceEditCommand.hack

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Facebook\HHAST\__Private\LSPLib;
1111

1212
use namespace Facebook\HHAST\__Private\LSP;
1313

14-
class ApplyWorkspaceEditCommand extends ClientCommand {
14+
final class ApplyWorkspaceEditCommand extends ClientCommand {
1515
const string METHOD = 'workspace/applyEdit';
1616
const type TParams = LSP\ApplyWorkspaceEditParams;
1717
}

0 commit comments

Comments
 (0)