Code Monkey home page Code Monkey logo

vite-plugin-eslint4b's Introduction

vite-plugin-eslint4b

Vite plugin for running ESLint on browser

Note
It is not a plugin for running ESLint during the build process.

With this plugin the following imports will work on the browser:

import { Linter } from 'eslint';

Usage

Installation

npm install --save-dev vite-plugin-eslint4b eslint

Configuration

// vite.config.ts
import type { UserConfig } from "vite";
import eslint4b from "vite-plugin-eslint4b";

const config: UserConfig = {
  plugins: [
    eslint4b(), // <-
  ],
};
export default config;

vite-plugin-eslint4b's People

Contributors

github-actions[bot] avatar ota-meshi avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vite-plugin-eslint4b's Issues

Cannot use this Vite plugin with "eslint-plugin-vue" and "vue-eslint-parser"

Hello!

Description

I tried to use this plugin with eslint-plugin-vue and vue-eslint-parser to lint my vue components in browser like eslint-plugin-vue-demo.
But I get the following error:

✘ [ERROR] Could not read from file: /Users/xxxx/vite-plugin-eslint4b/tests/vue-app/virtual:eslint4b_eslint

    node_modules/.pnpm/[email protected]/node_modules/eslint-plugin-vue/lib/utils/index.js:80:25:
      80 │   const eslint = require('eslint')

Reproduction

randomVariable2000@ea3e56e

Cannot use this Vite plugin with @typescript-eslint/utils

Hi!

I tried to create Monaco editor with ESLint preview on my documentation website. This is the documentation for the ESLint plugin.

But my plugin uses the helpers and types from @typescript-eslint/utils. When I try to import rules from my ESLint plugin I get the following error:

  vitepress v1.0.0-alpha.75

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
✘ [ERROR] Could not read from file: /Users/azat/Developer/eslint-plugin-perfectionist/virtual:eslint4b_eslint

    node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@typescript-eslint/utils/dist/ts-eslint/CLIEngine.js:6:25:
      6 │ const eslint_1 = require("eslint");
        ╵                          ~~~~~~~~

✘ [ERROR] Could not read from file: /Users/azat/Developer/eslint-plugin-perfectionist/virtual:eslint4b_eslint/package.json

    node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/RuleTester.js:54:31:
      54 │ const package_json_1 = require("eslint/package.json");
         ╵                                ~~~~~~~~~~~~~~~~~~~~~

11:13:47 PM [vitepress] error while updating dependencies:
Error: Build failed with 2 errors:
node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/RuleTester.js:54:31: ERROR: Could not read from file: /Users/azat/Developer/eslint-plugin-perfectionist/virtual:eslint4b_eslint/package.json
node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@typescript-eslint/utils/dist/ts-eslint/CLIEngine.js:6:25: ERROR: Could not read from file: /Users/azat/Developer/eslint-plugin-perfectionist/virtual:eslint4b_eslint
    at failureErrorWithLog (/Users/azat/Developer/eslint-plugin-perfectionist/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1636:15)
    at /Users/azat/Developer/eslint-plugin-perfectionist/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1048:25
    at /Users/azat/Developer/eslint-plugin-perfectionist/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1512:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Does that mean I can't use your Vite plugin because my ESLint plugin imports ESLint?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.