google / eslint-config-google

ESLint shareable config for the Google JavaScript style guide
Apache License 2.0
1.74k stars 140 forks source link

Missing rule to ensure file extension in module imports #69

Open chkpnt opened 2 years ago

chkpnt commented 2 years ago

According to 3.4.1.1.1 File extensions in import paths, "the .js file extension is not optional in import paths and must always be included."

I guess this rule shouldn't be limited to '.js' but to all imported modules. Nevertheless, eslint-config-google should be able to enforce 3.4.1.1.1.

Currently, I'm using import/extension from eslint-plugin-import with this config:

rules: {
   // ...
   "import/extensions": ["error", "always"],
  // ...
}

In order to enforce 3.4.1.1.1 one-to-one, "import/extensions": ["error", { js: "always" }] is the corresponding configuration.

I suggest to include (copy?) import/extension into eslint-config-google.