erisu commented on code in PR #130:
URL: https://github.com/apache/cordova-fetch/pull/130#discussion_r2238235015


##########
eslint.config.js:
##########
@@ -0,0 +1,43 @@
+/**
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+*/
+
+const { defineConfig, globalIgnores } = require('eslint/config');
+const nodeConfig = require('@cordova/eslint-config/node');
+const nodeTestConfig = require('@cordova/eslint-config/node-tests');
+
+module.exports = defineConfig([
+    globalIgnores([
+        '**/coverage/'
+    ]),
+    ...nodeConfig.map(config => ({
+        ...config,
+        rules: {
+            ...(config.rules || {}),
+            'no-unused-vars': ['error', {
+                args: 'after-used',
+                vars: 'all',
+                ignoreRestSiblings: true
+            }]
+        }
+    })),

Review Comment:
   Comparing the old ESLint config, I believe all you need here is the 
following:
   
   ```
   ...nodeConfig,
   ```
   
   I suspect you copied this ESLint config from one of the other repos I 
converted where that repo had an additional override from the default config.
   
   Most repos shouldn't have additional overrides and can use defaults.
   
   I am currently away from a PC for a week, so I won't be able to confirm till 
I return.



##########
index.js:
##########
@@ -133,8 +135,8 @@ async function resolvePathToPackage (name, basedir) {
 async function isNpmInstalled () {
     try {
         return await which('npm');
-    } catch (e) {
-        throw new CordovaError('"npm" command line tool is not installed: make 
sure it is accessible on your PATH.');
+    } catch (err) {
+        throw new CordovaError('"npm" command line tool is not installed: make 
sure it is accessible on your PATH.', err);

Review Comment:
   Might be able to remove `err` all together.
   
   I would have to look up CordovaError when I return, but it should be an 
extension of Error object so that means the second parameter should be either 
an object or fileName.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to