Skip to content

How do you get this to work? #54

@trusktr

Description

@trusktr

I have a config file like this:

.eslintrc.js
module.exports = {
  root: true,

  parser: '@typescript-eslint/parser',
  parserOptions: {
    ecmaVersion: 2018,
    sourceType: 'module',
  },

  env: {
    browser: true,
    node: true,
    es2017: true,
  },

  plugins: [
    'json', // doesn't seem to do anything with JSON files
    'promise', // https://github.com/xjamundx/eslint-plugin-promise
    'html',
  ],

  extends: [
    // Uses the recommended rules from the @typescript-eslint/eslint-plugin
    'plugin:@typescript-eslint/recommended',
    // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
    'prettier/@typescript-eslint',
    'plugin:json/recommended',
    // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
    'plugin:prettier/recommended',
  ],

  // add your custom rules here
  rules: {
    'no-debugger': 'error',
    'prefer-const': 'error',
    'one-var': ['error', 'never'],
    'no-var': 'error',
    'no-return-assign': ['error', 'except-parens'],
    'brace-style': ['error', '1tbs', {allowSingleLine: false}],
    'quote-props': ['error', 'as-needed'],
    curly: ['error', 'multi-or-nest', 'consistent'],

    // --- PROMISE ---------------------------------
    // from https://github.com/xjamundx/eslint-plugin-promise

    'promise/always-return': 'off',
    'promise/no-return-wrap': 'error',
    'promise/param-names': 'error',
    'promise/catch-or-return': 'error',
    'promise/no-new-statics': 'error',
    'promise/no-return-in-finally': 'error',

    // --- TYPESCRIPT ------------------------------

    'no-undef': 0,
    'no-unused-vars': 0,

    '@typescript-eslint/naming-convention': 'off', // — Require community JS/TS variable naming conventions. TODO, this one has lots of options.
    '@typescript-eslint/adjacent-overload-signatures': 'error', // — Require that member overloads be consecutive
    '@typescript-eslint/explicit-function-return-type': 'error', // — Require explicit return types on functions and class methods
    '@typescript-eslint/explicit-module-boundary-types': 'off', // — Require explicit types on all things that are exported from modules. Off because we handle this with the explicit-function-return-type rule paired with (soon) the noImplicitAny option in tsconfig.
    '@typescript-eslint/consistent-type-assertions': 'error', // — Enforces the use of `as` Type assertions instead of <Type> assertions.
    '@typescript-eslint/no-array-constructor': 'error', // — Disallow generic Array constructors
    '@typescript-eslint/no-explicit-any': 'off', // — Disallow usage of the any type
    '@typescript-eslint/no-inferrable-types': 'off', // — Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean.
    '@typescript-eslint/no-namespace': 'off', // — Disallow the use of custom TypeScript modules and namespaces
    '@typescript-eslint/triple-slash-reference': 'error', // — Disallow /// <reference path="" /> comments
    '@typescript-eslint/no-unused-vars': 'off', // — Off beacuse TypeScript gives us these errors already.
    '@typescript-eslint/no-var-requires': 'off', // — Disallows the use of require statements except in import statements
    '@typescript-eslint/type-annotation-spacing': ['error', {}], // — Require consistent spacing around type annotations
    '@typescript-eslint/no-non-null-assertion': 'off', // — Prevents non-null assertiong with `!`
  },

  settings: {},
}

And then I try to run

eslint package.json

and it finishes without outputting anything to console, regardless of what format I have in my package.json.


I've tried getting eslint-plugin-json to work a few times over the past couple years, over several versions of eslint, but it always seems not to do anything.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions