Skip to content

Commit 6996c7f

Browse files
committed
eslint: plugin for imports + code gen moduke conf
- updated eslint config for workspace generator so that existing code does not throw errors, but scope for code standardization is apparent. - currently the codebase does not employ and standardization in import/export rules and they are all over the place currently - adding this eslint plugin will enforce import/export guidelines in combination with prettier and ensures all imports are standardized across the codebase
1 parent 17c7571 commit 6996c7f

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

.eslintrc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"root": true,
33
"parser": "@typescript-eslint/parser",
4-
"plugins": ["@typescript-eslint"],
4+
"plugins": ["@typescript-eslint", "simple-import-sort"],
55
"extends": [
66
"eslint:recommended",
77
"plugin:@typescript-eslint/eslint-recommended",
@@ -11,6 +11,8 @@
1111
"prefer-const": "warn",
1212
"no-unused-vars": "warn",
1313
"no-async-promise-executor": "off",
14-
"@typescript-eslint/no-inferrable-types": "off"
14+
"@typescript-eslint/no-inferrable-types": "off",
15+
"simple-import-sort/imports": "error",
16+
"simple-import-sort/exports": "error"
1517
}
1618
}

generator/generators/.eslintrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../.eslintrc",
3+
"ignorePatterns": [
4+
"*.js",
5+
"node_modules/",
6+
"dummyClasses/",
7+
"generatedClasses/"
8+
]
9+
}

generator/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
],
1212
"scripts": {
1313
"test": "cross-env TS_NODE_FILES=true mocha --exit --require ts-node/register --colors test/**/*.ts",
14-
"tool": "tsc main && node main"
14+
"tool": "tsc main && node main",
15+
"lint": "eslint .",
16+
"lint-fix": "eslint --fix ."
1517
},
1618
"dependencies": {
1719
"@azure/arm-appservice": "^6.0.0",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"chai": "^4.2.0",
4444
"cross-env": "^7.0.2",
4545
"eslint": "^8.13.0",
46+
"eslint-plugin-simple-import-sort": "^7.0.0",
4647
"husky": "^4.3.0",
4748
"jsdoc": "^3.6.5",
4849
"lerna": "^3.22.1",

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3566,6 +3566,11 @@ escape-string-regexp@^4.0.0:
35663566
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
35673567
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
35683568

3569+
eslint-plugin-simple-import-sort@^7.0.0:
3570+
version "7.0.0"
3571+
resolved "https://registry.yarnpkg.com/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz#a1dad262f46d2184a90095a60c66fef74727f0f8"
3572+
integrity sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw==
3573+
35693574
eslint-scope@^5.1.1:
35703575
version "5.1.1"
35713576
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"

0 commit comments

Comments
 (0)