diff --git a/assets/plugin-template/.eslintignore b/assets/plugin-template/.eslintignore deleted file mode 100644 index 23f8944..0000000 --- a/assets/plugin-template/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -build -dist -example-app diff --git a/assets/plugin-template/eslint.config.cjs b/assets/plugin-template/eslint.config.cjs new file mode 100644 index 0000000..d307a5c --- /dev/null +++ b/assets/plugin-template/eslint.config.cjs @@ -0,0 +1,16 @@ +const ionic = require('@ionic/eslint-config/recommended'); + +module.exports = [ + { + ignores: [ + '**/build/**', + '**/dist/**', + 'example-app/**', + // lint TypeScript only + '**/*.js', + '**/*.mjs', + '**/*.cjs', + ], + }, + ...ionic, +]; diff --git a/assets/plugin-template/package.json.mustache b/assets/plugin-template/package.json.mustache index ac3f65b..f1f90b7 100644 --- a/assets/plugin-template/package.json.mustache +++ b/assets/plugin-template/package.json.mustache @@ -38,7 +38,7 @@ "verify:web": "npm run build", "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint", "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format", - "eslint": "eslint . --ext ts", + "eslint": "eslint .", "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java", "swiftlint": "node-swiftlint", "docgen": "docgen --api {{ CLASS }}Plugin --output-readme README.md --output-json dist/docs.json", @@ -52,10 +52,10 @@ "@capacitor/core": "^{{{ CAPACITOR_VERSION }}}", "@capacitor/docgen": "^0.3.1", "@capacitor/ios": "^{{{ CAPACITOR_VERSION }}}", - "@ionic/eslint-config": "^0.4.0", + "@ionic/eslint-config": "^0.5.0", "@ionic/prettier-config": "^4.0.0", "@ionic/swiftlint-config": "^2.0.0", - "eslint": "^8.57.1", + "eslint": "^10.0.0", "prettier": "^3.6.2", "prettier-plugin-java": "^2.7.7", "rimraf": "^6.1.0", @@ -68,9 +68,6 @@ }, "prettier": "@ionic/prettier-config", "swiftlint": "@ionic/swiftlint-config", - "eslintConfig": { - "extends": "@ionic/eslint-config/recommended" - }, "capacitor": { "ios": { "src": "ios" diff --git a/eslint.config.cjs b/eslint.config.cjs new file mode 100644 index 0000000..0752f1f --- /dev/null +++ b/eslint.config.cjs @@ -0,0 +1,14 @@ +const ionic = require('@ionic/eslint-config/recommended'); + +module.exports = [ + { + ignores: [ + '**/dist/**', + // lint TypeScript only + '**/*.js', + '**/*.mjs', + '**/*.cjs', + ], + }, + ...ionic, +]; diff --git a/package.json b/package.json index 0eaf99c..440ea4b 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "pack-assets": "node ./scripts/pack-assets.mjs", "lint": "npm run eslint && npm run prettier -- --check", "fmt": "npm run eslint -- --fix && npm run prettier -- --write", - "eslint": "eslint . --ext ts", + "eslint": "eslint .", "prettier": "prettier \"**/*.{css,html,js,mjs,ts}\"", "build": "npm run clean && npm run pack-assets && tsc", "clean": "rimraf ./dist", @@ -44,9 +44,6 @@ }, "license": "MIT", "prettier": "@ionic/prettier-config", - "eslintConfig": { - "extends": "@ionic/eslint-config/recommended" - }, "dependencies": { "debug": "^4.4.3", "kleur": "^4.1.5", @@ -56,12 +53,12 @@ "tslib": "^2.8.1" }, "devDependencies": { - "@ionic/eslint-config": "^0.4.0", + "@ionic/eslint-config": "^0.5.0", "@ionic/prettier-config": "^4.0.0", "@types/debug": "^4.1.12", "@types/mustache": "^4.2.6", "@types/prompts": "^2.4.9", - "eslint": "^8.57.1", + "eslint": "^10.0.0", "np": "^10.2.0", "prettier": "^3.7.4", "rimraf": "^6.1.2", diff --git a/src/index.ts b/src/index.ts index ff08d4b..2e65c2d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,7 +16,7 @@ const isInsideGitRepo = async (cwd: string): Promise => { try { await runSilent('git', ['rev-parse', '--is-inside-work-tree'], { cwd, stdio: 'ignore' }); return true; - } catch (e) { + } catch { return false; } }; diff --git a/src/template.ts b/src/template.ts index 6446f8e..70f9752 100644 --- a/src/template.ts +++ b/src/template.ts @@ -69,7 +69,7 @@ const folderExists = async (folderPath: string): Promise => { try { const files = await readdir(folderPath); return files != null; - } catch (err) { + } catch { return false; } };