<commit_before>/**
 * @license
 * Copyright 2014 Palantir Technologies, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import * as utils from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

const OPTION_CHECK_PARAMETERS = "check-parameters";
const OPTION_IGNORE_PATTERN = "ignore-pattern";

export class Rule extends Lint.Rules.TypedRule {
    /* tslint:disable:object-literal-sort-keys */
    public static metadata: Lint.IRuleMetadata = {
        ruleName: "no-unused-variable",
        description: Lint.Utils.dedent`Disallows unused imports, variables, functions and
            private class members. Similar to tsc's --noUnusedParameters and --noUnusedLocals
            options, but does not interrupt code compilation.`,
        hasFix: true,
        optionsDescription: Lint.Utils.dedent`
            Three optional arguments may be optionally provided:

            * \`"check-parameters"\` disallows unused function and constructor parameters.
                * NOTE: this option is experimental and does not work with classes
                that use abstract method declarations, among other things.
            * \`{"ignore-pattern": "pattern"}\` where pattern is a case-sensitive regexp.
            Variable names that match the pattern will be ignored.`,
        options: {
            type: "array",
            items: {
                oneOf: [{
                    type: "string",
                    enum: ["check-parameters", "react"],
                }, {
                    type: "object",
                    properties: {
                        "ignore-pattern": {type: "string"},
                    },
                    additionalProperties: false,
                }],
            },
            minLength: 0,
            maxLength: 3,
        },
        optionExamples: ['[true, "react"]', '[true, {"ignore-pattern": "^_"}]'],
        type: "functionality",
        typescriptOnly: true,
    };
    /* tslint:enable:object-literal-sort-keys */
<commit_msg>no-unused-variable: "react" option unnecessary, this is handled by default (#2465)<commit_after>/**
 * @license
 * Copyright 2014 Palantir Technologies, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import * as utils from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

const OPTION_CHECK_PARAMETERS = "check-parameters";
const OPTION_IGNORE_PATTERN = "ignore-pattern";

export class Rule extends Lint.Rules.TypedRule {
    /* tslint:disable:object-literal-sort-keys */
    public static metadata: Lint.IRuleMetadata = {
        ruleName: "no-unused-variable",
        description: Lint.Utils.dedent`Disallows unused imports, variables, functions and
            private class members. Similar to tsc's --noUnusedParameters and --noUnusedLocals
            options, but does not interrupt code compilation.`,
        hasFix: true,
        optionsDescription: Lint.Utils.dedent`
            Three optional arguments may be optionally provided:

            * \`"check-parameters"\` disallows unused function and constructor parameters.
                * NOTE: this option is experimental and does not work with classes
                that use abstract method declarations, among other things.
            * \`{"ignore-pattern": "pattern"}\` where pattern is a case-sensitive regexp.
            Variable names that match the pattern will be ignored.`,
        options: {
            type: "array",
            items: {
                oneOf: [{
                    type: "string",
                    enum: ["check-parameters"],
                }, {
                    type: "object",
                    properties: {
                        "ignore-pattern": {type: "string"},
                    },
                    additionalProperties: false,
                }],
            },
            minLength: 0,
            maxLength: 3,
        },
        optionExamples: ["[true]", '[true, {"ignore-pattern": "^_"}]'],
        type: "functionality",
        typescriptOnly: true,
    };
    /* tslint:enable:object-literal-sort-keys */

{'fraction_non_alphanumeric': 0.0986957368113685, 'fraction_numerical': 0.0046719875413665565, 'mean_word_length': 2.2072409488139826, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6519780', 'n_tokens_mistral': 1313, 'n_tokens_neox': 1253, 'n_words': 461}