# import-no-weak

Source: https://api-genie.dev/docs/linter/protobuf/rules/import-no-weak

A rule of the Protobuf linter, which reads proto3 files; the reader rejects proto2 and editions files. Since 0.9.0. In the rulesets: Recommended at warning, Strict at error, All at error.

This rule checks whether a Protobuf file uses `import weak`.

## Rule details

A weak import lets a file compile when the imported file is not linked into the program. It is
an undocumented feature, supported by few code generators, and its semantics differ between
them.

The `import-no-weak` rule reports `Import '<import>' should not be weak` for every
`import weak` statement.

## Examples

**Good**.

```proto
syntax = "proto3";

package acme.pets.v1;

import "google/protobuf/timestamp.proto";

message Pet {
  string name = 1;
  google.protobuf.Timestamp born_at = 2;
}
```

**Bad**. The linter reports `Import 'google/protobuf/timestamp.proto' should not be weak`.

```proto
syntax = "proto3";

package acme.pets.v1;

import weak "google/protobuf/timestamp.proto";

message Pet {
  string name = 1;
  google.protobuf.Timestamp born_at = 2;
}
```
