Browse Source

eslinting: make sure the projects have a lint command

Mokhtar Naamani 4 years ago
parent
commit
46807c7476

+ 2 - 1
cli/.prettierignore

@@ -1 +1,2 @@
-/lib/
+/lib/
+.nyc_output

+ 2 - 3
cli/package.json

@@ -85,13 +85,12 @@
   },
   "scripts": {
     "postpack": "rm -f oclif.manifest.json",
-    "posttest": "eslint . --ext .ts",
+    "posttest": "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",
-    "prettier-write": "prettier --write ."
+    "lint": "eslint ./src/ --quiet --ext .ts && tsc --noEmit --pretty"
   },
   "types": "lib/index.d.ts"
 }

+ 4 - 0
devops/eslint-config/index.js

@@ -39,6 +39,10 @@ module.exports = {
     // drop these when using newer versions of eslint-plugin-react-hooks
     'react-hooks/rules-of-hooks': 'error',
     'react-hooks/exhaustive-deps': 'warn',
+    // only cli projects should really have this rule, web apps
+    // should prefer using 'debug' package at least to allow control of
+    // output verbosity if logging to console.
+    'no-console': 'off',
   },
   plugins: [
     'standard',

+ 33 - 40
storage-node/.eslintrc.js

@@ -1,42 +1,35 @@
 module.exports = {
-    env: {
-        node: true,
-        es6: true,
-		mocha: true,
+  env: {
+    node: true,
+    es6: true,
+    mocha: true,
+  },
+  rules: {
+    'import/no-commonjs': 'off', // remove after converting to TS.
+    // Disabling Rules because of monorepo environment:
+    // https://github.com/benmosher/eslint-plugin-import/issues/1174
+    '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',
+  },
+  overrides: [
+    {
+      files: [
+        '**/test/ranges.js',
+        '**/test/lru.js',
+        '**/test/fs/walk.js',
+        '**/test/storage.js',
+        '**/test/identities.js',
+        '**/test/balances.js',
+        '**/test/assets.js',
+      ],
+      rules: {
+        // Disabling Rules because of used chai lib:
+        // https://stackoverflow.com/questions/45079454/no-unused-expressions-in-mocha-chai-unit-test-using-standardjs
+        'no-unused-expressions': 'off',
+      },
     },
-    globals: {
-        Atomics: "readonly",
-        SharedArrayBuffer: "readonly",
-    },
-    extends: [
-        "esnext",
-        "esnext/style-guide",
-        "plugin:prettier/recommended"
-    ],
-	"rules": {
-		"import/no-commonjs": "off", // remove after converting to TS.
-		// Disabling Rules because of monorepo environment:
-		// https://github.com/benmosher/eslint-plugin-import/issues/1174
-		"import/no-extraneous-dependencies": "off",
-		"import/no-nodejs-modules": "off", // nodejs project
-		"no-console": "off" // we use console in the project
-	},
-	"overrides": [
-		{
-			"files": [
-				"**/test/ranges.js",
-				"**/test/lru.js",
-				"**/test/fs/walk.js",
-				"**/test/storage.js",
-				"**/test/identities.js",
-				"**/test/balances.js",
-				"**/test/assets.js",
-			],
-			"rules": {
-				// Disabling Rules because of used chai lib:
-				// https://stackoverflow.com/questions/45079454/no-unused-expressions-in-mocha-chai-unit-test-using-standardjs
-				"no-unused-expressions": "off",
-			}
-		}
-	]
-};
+  ],
+}

+ 0 - 8
storage-node/.prettierrc

@@ -1,8 +0,0 @@
-{
-    "semi": false,
-    "trailingComma": "es5",
-    "singleQuote": true,
-	"arrowParens": "avoid",
-	"useTabs": false,
-	"tabWidth": 2
-}

+ 1 - 1
tests/network-tests/package.json

@@ -6,7 +6,7 @@
     "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",
+    "lint": "eslint . --quiet --ext .ts  && tsc --noEmit --pretty",
     "prettier-write": "prettier --write ./src"
   },
   "dependencies": {