Skip to content

Commit 8c4400a

Browse files
Add an eslint rule for import file extensions (#438)
1 parent d2f81e1 commit 8c4400a

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.eslintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"root": true,
33
"parser": "@typescript-eslint/parser",
44
"plugins": [
5-
"@typescript-eslint"
5+
"@typescript-eslint",
6+
"import"
67
],
78
"extends": [
89
"eslint:recommended",
@@ -35,6 +36,7 @@
3536
"comma-spacing" : "error",
3637
"no-multi-spaces" : "error",
3738
"prefer-template" : "error",
39+
"import/extensions": [2, "ignorePackages"],
3840
"max-nested-callbacks" : ["error",{
3941
"max": 3
4042
}],

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
"build:copyCleanPackageJSON": "ts-node scripts/copyPackageJsonToSrc.ts",
2323
"build:injectPackageVersion": "ts-node ./scripts/injectPackageVersionToDistFiles.ts",
2424
"build:updatePackageExports": "ts-node scripts/updatePackageJsonExports.ts",
25-
"lint": "eslint src __TESTS__ --color --ext .ts",
25+
"lint": "npm run lint:src && npm run lint:test",
26+
"lint:src" : "eslint src --color --ext .ts",
27+
"lint:test": "eslint __TESTS__ __TESTS_BUNDLE_SIZE__ --rule 'import/extensions: [0, \"never\"]' --color --ext .ts",
2628
"start": "rollup -c rollup.dev.config.js -w",
2729
"bundlewatch": "bundlewatch --config ./bundlewatch.config.js",
2830
"release-dry-run": "npm run build && cp README.md LICENSE ./dist && cd ./dist && release-it --dry-run",
@@ -52,6 +54,7 @@
5254
"clipboard": "2.0.1",
5355
"cloudinary-core": "^2.11.4",
5456
"eslint": "^6.8.0",
57+
"eslint-plugin-import": "^2.24.2",
5558
"extend": "^3.0.1",
5659
"glob": "^7.1.2",
5760
"grunt": "^1.0.2",
@@ -112,4 +115,4 @@
112115
"default": "./index.js"
113116
}
114117
}
115-
}
118+
}

0 commit comments

Comments
 (0)