diff --git a/.eslintrc.yaml b/.eslintrc.yaml index bda2f84..035a400 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -2,15 +2,6 @@ env: node: true es6: true mocha: true + es2022: true -plugins: - - haraka - -extends: [ "eslint:recommended", "plugin:haraka/recommended" ] - -root: true - -rules: - indent: [2, 4, {"SwitchCase": 1}] - no-console: 0 - no-unused-vars: 1 +extends: ['@haraka'] diff --git a/Changes.md b/Changes.md index af6b6fd..b8cb0be 100644 --- a/Changes.md +++ b/Changes.md @@ -1,11 +1,11 @@ ### Unreleased -### 1.2.0 - 202Y-MM-DD +### 1.2.0 - 2024-04-14 +- - deps: version bumps - ### 1.1.0 - 2022-05-27 - chore(ci): depend on shared GHA workflows diff --git a/configfile.js b/configfile.js index 8e3491a..5d756c4 100644 --- a/configfile.js +++ b/configfile.js @@ -73,7 +73,7 @@ class cfreader { } on_watch_event (name, type, options, cb) { - return (fse, filename) => { + return (fse) => { if (this._sedation_timers[name]) { clearTimeout(this._sedation_timers[name]); } @@ -221,7 +221,7 @@ class cfreader { const type = opts.type || 'binary'; isDirectory(name) - .then((result) => { + .then(() => { return fsReadDir(name); }) .then((fileList) => { diff --git a/package.json b/package.json index 7adf0c9..ca92bab 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,9 @@ "url": "git@github.com:haraka/haraka-config.git" }, "main": "config.js", + "files": ["readers","configfile.js","CHANGELOG.md"], "engines": { - "node": ">=12" + "node": ">=16" }, "dependencies": { "js-yaml": "^4.1.0" @@ -20,18 +21,20 @@ "hjson": "^3.2.2" }, "devDependencies": { - "eslint": "^8.56.0", - "eslint-plugin-haraka": "^1.0.15", - "mocha": "^10.3.0" + "@haraka/eslint-config": "^1.1.1" }, "bugs": { "mail": "haraka.mail@gmail.com", "url": "https://github.com/haraka/haraka-config/issues" }, "scripts": { - "test": "npx mocha test test/readers", - "lint": "npx eslint *.js readers test test/*/*.js", - "lintfix": "npx eslint --fix *.js readers test test/*/*.js", - "versions": "npx dependency-version-checker check" + "format": "npm run prettier:fix && npm run lint:fix", + "lint": "npx eslint@^8 *.js readers test test/*/*.js", + "lint:fix": "npx eslint@^8 *.js readers test test/*/*.js --fix", + "prettier": "npx prettier . --check", + "prettier:fix": "npx prettier . --write --log-level=warn", + "test": "npx mocha@10 test test/readers", + "versions": "npx dependency-version-checker check", + "versions:fix": "npx dependency-version-checker update && npm run prettier:fix" } } diff --git a/readers/ini.js b/readers/ini.js index eb013c9..8c4d171 100644 --- a/readers/ini.js +++ b/readers/ini.js @@ -117,7 +117,6 @@ exports.init_booleans = (options, result) => { return result; } -exports.logger = (msg, level) => { - // if (!level) level = 'logwarn'; +exports.logger = (msg) => { console.log(msg); } diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml new file mode 100644 index 0000000..1837116 --- /dev/null +++ b/test/.eslintrc.yaml @@ -0,0 +1,2 @@ +rules: + no-unused-vars: 1 diff --git a/test/config.js b/test/config.js index 73fc324..29360a3 100644 --- a/test/config.js +++ b/test/config.js @@ -466,7 +466,6 @@ describe('getDir', function () { it('loads all files in dir', function (done) { this.config.getDir('dir', { type: 'binary' }, (err, files) => { assert.ifError(err); - // console.log(files); assert.equal(err, null); assert.equal(files.length, 3); assert.equal(files[0].data, `contents1${os.EOL}`); @@ -476,8 +475,7 @@ describe('getDir', function () { }) it('errs on invalid dir', function (done) { - this.config.getDir('dirInvalid', { type: 'binary' }, (err, files) => { - // console.log(arguments); + this.config.getDir('dirInvalid', { type: 'binary' }, (err) => { assert.equal(err.code, 'ENOENT'); done(); }) @@ -505,10 +503,9 @@ describe('getDir', function () { assert.equal(files.length, 3); assert.equal(files[0].data, `contents1${os.EOL}`); assert.equal(files[2].data, `contents3${os.EOL}`); - fs.writeFile(tmpFile, 'contents4\n', (err2, res) => { + fs.writeFile(tmpFile, 'contents4\n', (err2) => { assert.equal(err2, null); // console.log('file touched, waiting for callback'); - // console.log(res); }); } if (callCount === 2) {