Skip to content

Commit

Permalink
feat: update templates for eslint v9 (#179)
Browse files Browse the repository at this point in the history
* feat: update templates for eslint v9

1. use flat config
2. add .npmrc (package-lock=false), just same as eslint repo
3. update required node.js & eslint

* chore: fix linting errors

* chore: npm ci => npm install

* chore: rm .eslintignore

* ci: update gha ci v4

* chore: update jsdoc

* chore: update eslint-config-eslint v10

* fix: use 'flat/mixed-esm-and-cjs'
  • Loading branch information
aladdin-add authored May 22, 2024
1 parent 66c6b9b commit c383e9c
Show file tree
Hide file tree
Showing 18 changed files with 70 additions and 18,319 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

20 changes: 0 additions & 20 deletions .eslintrc.cjs

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
node-version: 'lts/*'
- name: Install dependencies
run: npm ci
run: npm install
- name: Lint files
run: npm run lint
test:
Expand All @@ -38,6 +38,6 @@ jobs:
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: npm ci
run: npm install
- name: Run tests
run: npm test
4 changes: 2 additions & 2 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
{ "type": "perf", "section": "Performance Improvements", "hidden": false }
]
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock = false
7 changes: 6 additions & 1 deletion app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@ import PluginGenerator from "../plugin/index.js";
import { fileURLToPath } from "node:url";
import path from "node:path";

const __dirname = path.dirname(fileURLToPath(import.meta.url)); // eslint-disable-line no-underscore-dangle
/* eslint-disable no-underscore-dangle -- cjs convention */
const __dirname = path.dirname(fileURLToPath(import.meta.url));

const RULE_GENERATOR_PATH = path.join(__dirname, "..", "rule", "index.js");
const PLUGIN_GENERATOR_PATH = path.join(__dirname, "..", "plugin", "index.js");
/* eslint-enable no-underscore-dangle -- cjs convention*/

//------------------------------------------------------------------------------
// Constructor
//------------------------------------------------------------------------------

/**
* Represents a generator for creating ESLint plugins/rules.
*/
export default class extends Generator {
async prompting() {
const answers = await this.prompt({
Expand Down
15 changes: 15 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import globals from "globals";
import eslintConfigESLint from "eslint-config-eslint";

export default [
...eslintConfigESLint,
{
name: "generator-eslint/global-ignores",
ignores: ["temp/", "*/templates/*"]
},
{
name: "generator-eslint/test-files",
files: ["tests/**/*.js"],
languageOptions: { globals: globals.mocha }
}
];
Loading

0 comments on commit c383e9c

Please sign in to comment.