From 0f2a8142fdd06918b391020e76a569ab09fff89f Mon Sep 17 00:00:00 2001 From: Dmitry Teslitsky Date: Tue, 1 Oct 2024 15:45:34 +0300 Subject: [PATCH 1/2] Update Readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 95da67a..14fd6f3 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ [![Build Status](https://travis-ci.org/teslitsky/mongoose-imei.svg?branch=master)](https://travis-ci.org/teslitsky/mongoose-imei) -Gives you the `Imei` type to use in your schemas, complete with validation using [node-imei](https://github.com/B2MSolutions/node-imei) library. https://en.wikipedia.org/wiki/International_Mobile_Equipment_Identity +Gives you the `Imei` type to use in your schemas, complete with validation using [node-imei](https://www.npmjs.com/package/node-imei) library. https://en.wikipedia.org/wiki/International_Mobile_Equipment_Identity ## Usage -Start with an `npm install --save mongoose-imei` +Start with an `npm install mongoose-imei` ```javascript const mongoose = require('mongoose'); From d672e91381db6ac70a52cf72737ae1319d196d05 Mon Sep 17 00:00:00 2001 From: Dmitry Teslitsky Date: Tue, 1 Oct 2024 15:57:26 +0300 Subject: [PATCH 2/2] Update ESLint rules - bump ESLint to v9 - remove eslint-config-airbnb-base - remove eslint-plugin-import - move Prettier and ESLint configs from package.json --- .prettierrc | 4 ++++ eslint.config.js | 24 ++++++++++++++++++++++++ lib/mongoose-imei.js | 1 - package.json | 25 ++++++------------------- 4 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 .prettierrc create mode 100644 eslint.config.js diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..a20502b --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "trailingComma": "all" +} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..43fcec2 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,24 @@ +const pluginJs = require('@eslint/js'); +const globals = require('globals'); +const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended'); + +module.exports = [ + pluginJs.configs.recommended, + eslintPluginPrettierRecommended, + { + languageOptions: { globals: globals.node }, + }, + { + files: ['**/*.js'], + languageOptions: { sourceType: 'commonjs' }, + }, + { + files: ['**/*.spec.js'], + languageOptions: { + globals: { + ...globals.node, + ...globals.jest, + }, + }, + }, +]; diff --git a/lib/mongoose-imei.js b/lib/mongoose-imei.js index 2114dcd..204c01d 100644 --- a/lib/mongoose-imei.js +++ b/lib/mongoose-imei.js @@ -1,4 +1,3 @@ -/* eslint-disable no-param-reassign */ const ImeiType = require('./imei-type'); function loadType(mongoose) { diff --git a/package.json b/package.json index 468b89b..75d9353 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "Mongoose type for IMEI", "main": "index.js", "scripts": { - "test": "jest tests/*.spec.js" + "test": "jest tests/*.spec.js", + "lint": "eslint" }, "repository": { "type": "git", @@ -26,27 +27,13 @@ "url": "https://github.com/teslitsky/mongoose-imei/issues" }, "homepage": "https://github.com/teslitsky/mongoose-imei#readme", - "eslintConfig": { - "root": true, - "env": { - "node": true, - "jest": true - }, - "extends": [ - "airbnb-base", - "prettier" - ] - }, - "prettier": { - "trailingComma": "all", - "singleQuote": true - }, "devDependencies": { + "@eslint/js": "9.11.1", "@types/jest": "29.5.13", - "eslint": "8.26.0", - "eslint-config-airbnb-base": "15.0.0", + "eslint": "9.11.1", "eslint-config-prettier": "8.5.0", - "eslint-plugin-import": "2.30.0", + "eslint-plugin-prettier": "5.2.1", + "globals": "15.9.0", "jest": "29.7.0", "mongodb-memory-server": "10.0.1", "mongoose": "8.7.0",