Giter Club home page Giter Club logo

Comments (5)

neviaumi avatar neviaumi commented on June 9, 2024 1

turn out i find it has conflict between my eslint config , thanks @ota-meshi for support

You did a great job to make our life more efficient !

from eslint-plugin-jsonc.

neviaumi avatar neviaumi commented on June 9, 2024

More info

https://github.com/ota-meshi/eslint-plugin-jsonc/blob/master/lib/rules/sort-keys.ts#L297

I try add logging here, the parserServices always undefined

from eslint-plugin-jsonc.

ota-meshi avatar ota-meshi commented on June 9, 2024

You need to change the presets you use.

-      extends: ['plugin:jsonc/prettier'],
+      extends: ['plugin:jsonc/base'],

from eslint-plugin-jsonc.

neviaumi avatar neviaumi commented on June 9, 2024

@ota-meshi i tried what you suggested , but no luck

from eslint-plugin-jsonc.

neviaumi avatar neviaumi commented on June 9, 2024

for fork who hit exact problem to me .

Here is some situation on my eslint config
i have shared eslint config which aim to support react, typescript, js in one js config

and my ts eslint config look like that

const { overrides } = require('./base');

const jsConfig = overrides.find(override => override.files.includes('*.js'));

module.exports = {
  overrides: [
    {
      extends: [
        ...jsConfig.extends,
        'plugin:@typescript-eslint/recommended',
        'plugin:import/typescript',
        'plugin:typescript-sort-keys/recommended',
      ],
      files: ['*.ts', '*.tsx'],
      parser: '@typescript-eslint/parser',
      rules: {
       // ....some ts rule here
      },
    },
  ],
  parser: '@typescript-eslint/parser',
  plugins: ['@typescript-eslint/eslint-plugin', 'typescript-sort-keys'],
  settings: {
    'import/resolver': {
      typescript: {},
    },
  },
};

i have put parser in top level of my json.

and seem it cause conflict between json parser used here.

i have attempt add parser options on .json but no luck.

and turn out i change my ts eslint like that

const { overrides } = require('./base');

const jsConfig = overrides.find(override => override.files.includes('*.js'));

module.exports = {
  overrides: [
    {
      extends: [
        ...jsConfig.extends,
        'plugin:@typescript-eslint/recommended',
        'plugin:import/typescript',
        'plugin:typescript-sort-keys/recommended',
      ],
      parser: '@typescript-eslint/parser',
      plugins: ['@typescript-eslint/eslint-plugin', 'typescript-sort-keys'],
      files: ['*.ts', '*.tsx'],
      parser: '@typescript-eslint/parser',
      rules: {
       // ....some ts rule here
      },
    },
  ],
  settings: {
    'import/resolver': {
      typescript: {},
    },
  },
};

from eslint-plugin-jsonc.

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.