// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

const path = require('path');
const rulesDirPlugin = require('eslint-plugin-rulesdir');
rulesDirPlugin.RULES_DIR = path.join(__dirname, '..', 'scripts', 'eslint_rules', 'lib');

module.exports = {
  'overrides': [{
    'files': ['*.ts'],
    'rules': {
      '@typescript-eslint/explicit-function-return-type': 2,

      'rulesdir/kebab_case_events': 2,
      'rulesdir/set_data_type_reference': 2,
      'rulesdir/lit_html_data_as_type': 2,
      'rulesdir/lit_no_style_interpolation': 2,
    }
  }]
};

// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

const path = require('path');
const rulesDirPlugin = require('eslint-plugin-rulesdir');
rulesDirPlugin.RULES_DIR = path.join(__dirname, '..', 'scripts', 'eslint_rules', 'lib');

module.exports = {
  'overrides': [{
    'files': ['*.ts'],
    'rules': {
      '@typescript-eslint/explicit-function-return-type': 2,

      'rulesdir/kebab_case_events': 2,
      'rulesdir/set_data_type_reference': 2,
      'rulesdir/lit_html_data_as_type': 2,
      'rulesdir/lit_no_style_interpolation': 2,
      '@typescript-eslint/naming-convention': [
        'error', {
          'selector': 'property',
          'modifiers': ['private', 'protected'],
          'format': ['camelCase'],
        },
        {
          'selector': 'method',
          'modifiers': ['private', 'protected'],
          'format': ['camelCase'],
        }
      ]
    }
  }]
};

Enforce camelCase for private and protected class members
Enforce camelCase for private and protected class members

This encodes some of the TypeScript style guides about identifiers
https://google.github.io/styleguide/tsguide.html#identifiers
(in particular the rules our codebase already adheres to).
The automatic enforcement will save time during code reviews.

The current TypeScript migration produces a lot of public class
properties and methods with leading underscores, so this CL only
enforces the rule for protected and private class members; the
rule can be enforced for public variables as well at a later
point in time.

Bug: chromium:1057042
Change-Id: Ic63b0a9b128f8b560020c015a0f91bbf72a9dd6d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2672026
Commit-Queue: Sigurd Schneider <f04d242e109628a27a0f75fd49a87722bcf291fd@chromium.org>
Reviewed-by: Tim van der Lippe <dba8716ee7f8d16236046f74d2167cb94410f6ed@chromium.org>
