How to use the eslint/lib/rules/indent.meta function in eslint

To help you get started, we’ve selected a few eslint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github typescript-eslint / typescript-eslint / packages / eslint-plugin / lib / rules / indent.js View on Github external
ignoredNodes: []
  }
];

module.exports = Object.assign({}, baseRule, {
  meta: {
    type: 'layout',
    docs: {
      description: 'Enforce consistent indentation',
      extraDescription: [util.tslintRule('indent')],
      category: 'Stylistic Issues',
      recommended: 'error',
      url: util.metaDocsUrl('indent')
    },
    fixable: 'whitespace',
    schema: baseRule.meta.schema,
    messages: baseRule.meta.messages
  },

  create(context) {
    // because we extend the base rule, have to update opts on the context
    // the context defines options as readonly though...
    const contextWithDefaults = Object.create(context, {
      options: {
        writable: false,
        configurable: false,
        value: util.applyDefault(defaultOptions, context.options)
      }
    });

    const rules = baseRule.create(contextWithDefaults);
github typescript-eslint / typescript-eslint / packages / eslint-plugin / lib / rules / indent.js View on Github external
}
];

module.exports = Object.assign({}, baseRule, {
  meta: {
    type: 'layout',
    docs: {
      description: 'Enforce consistent indentation',
      extraDescription: [util.tslintRule('indent')],
      category: 'Stylistic Issues',
      recommended: 'error',
      url: util.metaDocsUrl('indent')
    },
    fixable: 'whitespace',
    schema: baseRule.meta.schema,
    messages: baseRule.meta.messages
  },

  create(context) {
    // because we extend the base rule, have to update opts on the context
    // the context defines options as readonly though...
    const contextWithDefaults = Object.create(context, {
      options: {
        writable: false,
        configurable: false,
        value: util.applyDefault(defaultOptions, context.options)
      }
    });

    const rules = baseRule.create(contextWithDefaults);

    /**
github typescript-eslint / typescript-eslint / packages / eslint-plugin / src / rules / indent.ts View on Github external
AST_NODE_TYPES.TSUnionType,
  AST_NODE_TYPES.Decorator,
]);

export default util.createRule({
  name: 'indent',
  meta: {
    type: 'layout',
    docs: {
      description: 'Enforce consistent indentation',
      category: 'Stylistic Issues',
      // too opinionated to be recommended
      recommended: false,
    },
    fixable: 'whitespace',
    schema: baseRule.meta.schema,
    messages: baseRule.meta.messages,
  },
  defaultOptions: [
    // typescript docs and playground use 4 space indent
    4,
    {
      // typescript docs indent the case from the switch
      // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-8.html#example-4
      SwitchCase: 1,
      flatTernaryExpressions: false,
      ignoredNodes: [],
    },
  ],
  create(context, optionsWithDefaults) {
    // because we extend the base rule, have to update opts on the context
    // the context defines options as readonly though...
github typescript-eslint / typescript-eslint / packages / eslint-plugin / src / rules / indent.ts View on Github external
AST_NODE_TYPES.Decorator,
]);

export default util.createRule({
  name: 'indent',
  meta: {
    type: 'layout',
    docs: {
      description: 'Enforce consistent indentation',
      category: 'Stylistic Issues',
      // too opinionated to be recommended
      recommended: false,
    },
    fixable: 'whitespace',
    schema: baseRule.meta.schema,
    messages: baseRule.meta.messages,
  },
  defaultOptions: [
    // typescript docs and playground use 4 space indent
    4,
    {
      // typescript docs indent the case from the switch
      // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-8.html#example-4
      SwitchCase: 1,
      flatTernaryExpressions: false,
      ignoredNodes: [],
    },
  ],
  create(context, optionsWithDefaults) {
    // because we extend the base rule, have to update opts on the context
    // the context defines options as readonly though...
    const contextWithDefaults: typeof context = Object.create(context, {