Coder Social home page Coder Social logo

Comments (2)

mdjermanovic avatar mdjermanovic commented on May 20, 2024 1

Hi @mctrafik, thanks for the issue!

This works as intended. If the configuration object has other keys, ignores limits which files the configuration object applies to:

https://eslint.org/docs/latest/use/configure/configuration-files-new#excluding-files-with-ignores

To ignore files, ignores should be used without any other keys in the configuration object:

https://eslint.org/docs/latest/use/configure/configuration-files-new#globally-ignoring-files-with-ignores

In your example, the configuration would be:

import tseslint from 'typescript-eslint';

/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray} */
const configs = [
  {
    ignores: ['**/dist'],
  },
  {
    files: ['ts', 'tsx', 'cts', 'ctsx', 'mts', 'mtsx', 'js', 'cjs', 'mjs'].map(
      (ext) => `src/**/*.${ext}`
    ),
    plugins: {
      '@typescript-eslint': tseslint.plugin,
    },
    languageOptions: {
      globals: Object.fromEntries(
        ['jest', 'it', 'describe', 'test', 'expect'] // Jest
          .concat(['window', 'document', 'setTimeout', 'setInterval']) // DOM
          .map((key) => [key, true])
      ),
      ecmaVersion: 2022,

      parser: tseslint.parser,
      parserOptions: {
        project: ['./tsconfig.json'],
        sourceType: 'module',
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },
];

export default configs;

https://stackblitz.com/edit/stackblitz-starters-7dk5wd?file=eslint.config.mjs

from eslint.

mctrafik avatar mctrafik commented on May 20, 2024 1

I see there's a way to exclude it, but the for record, the fact that the config file species no other ignores, and those ignores are ignored is extremely counter-intuitive.

from eslint.

Related Issues (20)

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.