# import-no-weak

Source: https://apigenie.pl/docs/linter/protobuf/rules/import-no-weak

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.

## Configuration

This rule has no options.

## 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;
}
```

## When Not to Use It

We recommend to always enable this rule.

## Compatibility

This rule is compatible with proto3 files. proto2 and editions files are rejected by the reader
and are not linted.
