소스 검색

code style last tweaks, add format and checks yarn scripts

Mokhtar Naamani 4 년 전
부모
커밋
565ade3481
5개의 변경된 파일26개의 추가작업 그리고 7개의 파일을 삭제
  1. 14 0
      .editorconfig
  2. 4 2
      cli/package.json
  3. 2 2
      storage-node/.eslintrc.js
  4. 3 1
      storage-node/package.json
  5. 3 2
      tests/network-tests/package.json

+ 14 - 0
.editorconfig

@@ -0,0 +1,14 @@
+# In case prettier plugin or eslint with autofix is not enabled in IDE
+# The fallback settings here should match with our prettierrc config
+# so we get consistency!
+root = true
+
+[*]
+indent_style=space
+indent_size=2
+tab_width=2
+end_of_line=lf
+charset=utf-8
+trim_trailing_whitespace=true
+max_line_length=120
+insert_final_newline=true

+ 4 - 2
cli/package.json

@@ -85,12 +85,14 @@
   },
   "scripts": {
     "postpack": "rm -f oclif.manifest.json",
-    "posttest": "lint",
+    "posttest": "yarn lint",
     "prepack": "rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme",
     "test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
     "build": "tsc --build tsconfig.json",
     "version": "oclif-dev readme && git add README.md",
-    "lint": "eslint ./src/ --quiet --ext .ts && tsc --noEmit --pretty"
+    "lint": "eslint ./src/ --quiet --ext .ts",
+    "checks": "yarn lint && tsc --noEmit --pretty && prettier ./ --check",
+    "format": "prettier ./ --write"
   },
   "types": "lib/index.d.ts"
 }

+ 2 - 2
storage-node/.eslintrc.js

@@ -11,8 +11,8 @@ module.exports = {
     'import/no-extraneous-dependencies': 'off',
     'import/no-nodejs-modules': 'off', // nodejs project
     'no-console': 'off', // we use console in the project
-	'@typescript-eslint/no-var-requires': 'warn',
-	'@typescript-eslint/camelcase': 'warn',
+    '@typescript-eslint/no-var-requires': 'warn',
+    '@typescript-eslint/camelcase': 'warn',
   },
   overrides: [
     {

+ 3 - 1
storage-node/package.json

@@ -32,7 +32,9 @@
   ],
   "scripts": {
     "test": "wsrun --serial test",
-    "lint": "eslint --ignore-path .gitignore ."
+    "lint": "eslint --ignore-path .gitignore .",
+    "checks": "yarn lint && prettier . --check",
+    "format": "prettier ./ --write"
   },
   "devDependencies": {
     "eslint": "^5.16.0",

+ 3 - 2
tests/network-tests/package.json

@@ -6,8 +6,9 @@
     "build": "tsc --build tsconfig.json",
     "test": "tap --files ts-node/register src/constantinople/tests/proposals/*Test.ts",
     "test-migration": "tap --files src/rome/tests/romeRuntimeUpgradeTest.ts --files src/constantinople/tests/electingCouncilTest.ts",
-    "lint": "eslint . --quiet --ext .ts  && tsc --noEmit --pretty",
-    "prettier-write": "prettier --write ./src"
+    "lint": "eslint . --quiet --ext .ts",
+    "checks": "yarn lint && tsc --noEmit --pretty && prettier . --check",
+    "format": "prettier ./ --write "
   },
   "dependencies": {
     "@constantinople/types": "./types",