Skip to content

Commit

Permalink
chore: fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aladdin-add committed Apr 18, 2024
1 parent d7e82cd commit d416481
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 34 deletions.
2 changes: 0 additions & 2 deletions .eslintignore
@@ -1,3 +1 @@
node_modules/
temp/
*/templates/*
20 changes: 0 additions & 20 deletions .eslintrc.cjs

This file was deleted.

7 changes: 6 additions & 1 deletion app/index.js
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
//------------------------------------------------------------------------------

/**
*
*/
export default class extends Generator {
async prompting() {
const answers = await this.prompt({
Expand Down
13 changes: 10 additions & 3 deletions eslint.config.js
@@ -1,8 +1,15 @@
"use strict";
import globals from "globals";
import eslintConfigESLint from "eslint-config-eslint";

export default [
...eslintConfigESLint,
{files: ["tests/**/*.js"],
languageOptions: { globals: globals.mocha }}
{
name: "generator-eslint/global-ignores",
ignores: ["temp/", "*/templates/*"]
},
{
name: "generator-eslint/test-files",
files: ["tests/**/*.js"],
languageOptions: { globals: globals.mocha }
}
];
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -25,7 +25,7 @@
"scripts": {
"lint": "npm-run-all --continue-on-error --aggregate-output --parallel lint:*",
"lint:docs": "markdownlint \"**/*.md\"",
"lint:js": "eslint --report-unused-disable-directives .",
"lint:js": "eslint .",
"release:generate:latest": "eslint-generate-release",
"release:generate:alpha": "eslint-generate-prerelease alpha",
"release:generate:beta": "eslint-generate-prerelease beta",
Expand Down
3 changes: 3 additions & 0 deletions plugin/index.js
Expand Up @@ -21,6 +21,9 @@ import { isPluginId, isRequired } from "../lib/validators.js";
// Constructor
//------------------------------------------------------------------------------

/**
*
*/
export default class extends Generator {
async prompting() {
const prompts = [{
Expand Down
2 changes: 1 addition & 1 deletion plugin/templates/_eslint.config.mjs
Expand Up @@ -6,4 +6,4 @@ export default [
pluginJs.configs.recommended,
pluginNode.configs["flat/recommended"],
eslintPlugin.configs["flat/recommended"]
]
];
3 changes: 3 additions & 0 deletions rule/index.js
Expand Up @@ -19,6 +19,9 @@ import { isRuleId, isRequired } from "../lib/validators.js";
// Constructor
//------------------------------------------------------------------------------

/**
*
*/
export default class extends Generator {
async prompting() {
const prompts = [
Expand Down
5 changes: 3 additions & 2 deletions tests/app/index.js
Expand Up @@ -15,12 +15,13 @@ import path from "node:path";
//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

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 APP_GENERATOR_PATH = path.join(__dirname, "..", "..", "app", "index.js");
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 */

describe("ESLint Main Generator", () => {
describe("User answers with Plugin", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/plugin/index.js
Expand Up @@ -16,7 +16,7 @@ import path from "node:path";
// Tests
//------------------------------------------------------------------------------

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

const PLUGIN_GENERATOR_PATH = path.join(__dirname, "..", "..", "plugin", "index.js");

Expand Down
2 changes: 1 addition & 1 deletion tests/rule/index.js
Expand Up @@ -17,7 +17,7 @@ import path from "node:path";
// Tests
//------------------------------------------------------------------------------

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

const RULE_GENERATOR_PATH = path.join(__dirname, "..", "..", "rule", "index.js");

Expand Down
10 changes: 8 additions & 2 deletions tests/test-load.js
Expand Up @@ -5,8 +5,14 @@

import assert from "node:assert";

// eslint-disable-next-line func-style, node/no-unsupported-features/es-syntax -- https://github.com/mysticatea/eslint-plugin-node/issues/250
const importFresh = async modulePath => import(`${modulePath}?x=${new Date()}`);
/**
* Import a module fresh every time.
* @param {string} modulePath The path to the module to import.
* @returns {Promise<*>} The imported module.
*/
async function importFresh(modulePath) {
return import(`${modulePath}?x=${new Date()}`);
}

describe("eslint generator", () => {
it("can be imported without blowing up", () => {
Expand Down

0 comments on commit d416481

Please sign in to comment.