Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: eslint/eslint
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 58216b60ee0d431ad8c0e29befd7edba56d7811b
Choose a base ref
...
head repository: eslint/eslint
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e0cbc50179adac1670f4e0bd9093387a51f4f42a
Choose a head ref

Commits on Dec 1, 2017

  1. Docs: Adds an example with try/catch. (#9672)

    * Docs: Adds an example with try/catch.
    
    Clarifies with an example that `return await` inside an error handler is allowed by this rule.
    
    * Update no-return-await.md
    q42jaap authored and ilyavolodin committed Dec 1, 2017
    Copy the full SHA
    cdb1488 View commit details

Commits on Dec 5, 2017

  1. Chore: fix test-suite to work with node master (#9688)

    Changes to the output of strictEqual are breaking the test suite
    This minor adjustment to the regex will fix Node 10+ while keeping
    support for older versions of node
    MylesBorins authored and not-an-aardvark committed Dec 5, 2017
    Copy the full SHA
    1ad3091 View commit details

Commits on Dec 6, 2017

  1. Copy the full SHA
    d067ae1 View commit details

Commits on Dec 8, 2017

  1. Update: update handling of destructuring in camelcase (fixes #8511) (#…

    …9468)
    
    * Fix: handle destructuring with defaults in camelcase rule (fixes #8511)
    
    * Update: checking right-side of default value assignment
    
    adding to docs, tests, and fixing logic
    erindepew authored and kaicataldo committed Dec 8, 2017
    Copy the full SHA
    256481b View commit details
  2. Build: changelog update for 4.13.0

    ESLint Jenkins committed Dec 8, 2017
    Copy the full SHA
    ac331bc View commit details
  3. 4.13.0

    ESLint Jenkins committed Dec 8, 2017
    Copy the full SHA
    29c3610 View commit details

Commits on Dec 9, 2017

  1. Copy the full SHA
    4564fe0 View commit details
  2. Copy the full SHA
    d49d9d0 View commit details

Commits on Dec 11, 2017

  1. Copy the full SHA
    d80aa7c View commit details
  2. Fix: eol-last allow empty-string to always pass (refs #9534) (#9696)

    Note that there are already tests asserting this behavior, but they aren't actually run in the rules. See #9534
    platinumazure authored and ilyavolodin committed Dec 11, 2017
    Copy the full SHA
    b72dc83 View commit details
  3. Build: changelog update for 4.13.1

    ESLint Jenkins committed Dec 11, 2017
    Copy the full SHA
    3b0833f View commit details
  4. 4.13.1

    ESLint Jenkins committed Dec 11, 2017
    Copy the full SHA
    234cd26 View commit details

Commits on Dec 15, 2017

  1. Fix: false positive on rulelines-between-class-members (fixes #9665) (

    #9680)
    
    * Fix: `lines-between-class-memebers` (fixes #9665)
    
    `lines-between-class-memebers` if a comment occurs between class members
    
    * Add tests suggested by reviewers.
    
    * Add comments
    
    * Refactor: remove a nest.
    
    * Refactor: declare variables just before they are needed.
    sakabar authored and aladdin-add committed Dec 15, 2017
    Copy the full SHA
    43d4ba8 View commit details

Commits on Dec 16, 2017

  1. Docs: fix typos (#9723)

    * Fix typos
    
    * Fix capitalization manually
    tbroadley authored and platinumazure committed Dec 16, 2017
    Copy the full SHA
    f819920 View commit details
  2. Chore: improve arrow-body-style error message (refs #5498) (#9718)

    #5498 gets more than twice as
    much traffic as any of our other issues. My interpretation of this fact
    is that people are often confused by errors from the `arrow-body-style`
    rule, and end up searching and finding that issue. This commit updates
    the error message for `arrow-body-style` to be more specific about how
    to fix the problem.
    not-an-aardvark authored Dec 16, 2017
    Copy the full SHA
    14baa2e View commit details

Commits on Dec 17, 2017

  1. Copy the full SHA
    f44ce11 View commit details
  2. Copy the full SHA
    5a5c23c View commit details

Commits on Dec 19, 2017

  1. Copy the full SHA
    f252c19 View commit details
  2. Upgrade: debug@^3.1.0 (#9731)

    This version of debug addresses a minor ReDoS issue. See debug-js/debug#501, debug-js/debug#504 for more information. Looking at the rest of the changelog, this should be a pretty low-risk upgrade.
    platinumazure authored and aladdin-add committed Dec 19, 2017
    Copy the full SHA
    4ddc131 View commit details

Commits on Dec 20, 2017

  1. Update: Improve parser integrations (fixes #8392) (#8755)

    * rewrite traverser
    
    * add supports scope and visitorKeys of custorm parsers
    
    * add tests
    
    * scope → scopeManager in the result of `parser.parseForESLint`
    
    * keys → visitorKeys
    
    * move some functions to `create()` in no-unmodified-loop-condition
    
    * check `this.sourceCode.ast`
    
    * fix SourceCode parameter to one object
    
    * update for review
    
    * update Traverser with eslint-visitor-keys
    
    * tweak tests with eslint-visitor-keys
    
    * add `eslintVisitorKeys` and `eslintScopeManager` to parserOptions
    
    * update docs
    
    * fix list style
    
    * ensure `sourceCode.scopeManager` is set
    
    * Docs: update ScopeManager docs
    
    * update for review
    
    * fix some links to escope docs
    
    * update for review
    
    * upgrade eslint-visitor-keys to 1.0.0
    mysticatea authored and ilyavolodin committed Dec 20, 2017
    Copy the full SHA
    1c2aafd View commit details
  2. Copy the full SHA
    805a94e View commit details
  3. Copy the full SHA
    37d066c View commit details

Commits on Dec 21, 2017

  1. Docs: improve no-extra-parens formatting (#9747)

    The doc lists two exceptions in a bulleted list and then adds a third
    exception in prose. Move the prose to the bulleted list so it has three
    items.
    Trott authored and platinumazure committed Dec 21, 2017
    Copy the full SHA
    e9d5dfd View commit details
  2. New: Add allowImplicit option to array-callback-return (fixes #8539) (#…

    …9344)
    
    * New: Add allowImplicit option to array-callback-return (fixes #8539)
    
    * Chore: add tests
    
    * Update array-callback-return.md
    
    * chore: rename options
    
    * Update array-callback-return.js
    
    * Update array-callback-return.js
    
    * Update array-callback-return.js
    
    * Improve allowImplicit option description
    
    * Test explicit return when "allowImplicit": true
    jamescdavis authored and kaicataldo committed Dec 21, 2017
    Copy the full SHA
    ae51eb2 View commit details

Commits on Dec 22, 2017

  1. Docs: reintroduce misspelling in valid-typeof example (#9753)

    This example is intended to be an invalid `typeof` string, to illustrate that the rule reports an error if the user makes a typo like this. However, the spelling was inadvertently corrected in aedae9d, so the documentation is now incorrect (it says that `valid-typeof` reports an error for that code, when in fact it does not).
    not-an-aardvark authored Dec 22, 2017
    Copy the full SHA
    eb4b1e0 View commit details

Commits on Dec 23, 2017

  1. Copy the full SHA
    75c7419 View commit details
  2. Chore: Reorganize CLI options and associated docs (#9758)

    * Chore: Moved cache options below some more important option sets
    
    * Chore: Created "Inline configuration comments" option section
    
    * Chore: Created "Fixing problems" option section
    platinumazure authored and ilyavolodin committed Dec 23, 2017
    Copy the full SHA
    8196c45 View commit details
  3. Docs: Fix typos (#9751)

    * Docs: Fix typos
    
    * s/RegExp/Regular Expression/
    j-f1 authored and ilyavolodin committed Dec 23, 2017
    Copy the full SHA
    370d614 View commit details
  4. Update: support separate requires in one-var. (fixes #6175) (#9441)

    * Update: support separate requires in one-var. (fixes #6175)
    
    * wip.
    
    * fix edge case.
    
    * Docs: add JSCS link
    aladdin-add authored and ilyavolodin committed Dec 23, 2017
    Copy the full SHA
    be2f57e View commit details
  5. Build: changelog update for 4.14.0

    ESLint Jenkins committed Dec 23, 2017
    Copy the full SHA
    5a29612 View commit details
  6. 4.14.0

    ESLint Jenkins committed Dec 23, 2017
    Copy the full SHA
    8d166b4 View commit details

Commits on Dec 24, 2017

  1. Copy the full SHA
    f7dcb70 View commit details
  2. Copy the full SHA
    cbf0fb9 View commit details

Commits on Dec 27, 2017

  1. Docs: HTTP -> HTTPS (fixes #9768) (#9768)

    URLs were updated to use HTTPS protocol
    tag: Docs
    him2him2 authored and gyandeeps committed Dec 27, 2017
    Copy the full SHA
    db431cb View commit details

Commits on Dec 28, 2017

  1. Update: add ignoreComments option to indent rule (fixes #9018) (#…

    …9752)
    
    * Update: add `ignoreComments` option to `indent` rule (fixes #9018)
    
    * Chore: Added basic tests for block comments
    platinumazure authored Dec 28, 2017
    1
    Copy the full SHA
    bbabf34 View commit details

Commits on Dec 30, 2017

  1. Fix: incorrect error messages of no-unused-vars (fixes #9774) (#9791)

    Remove varsIgnorePattern incorrectly included in error messages of no-unused-vars.
    akouryy authored and aladdin-add committed Dec 30, 2017
    Copy the full SHA
    4c87f42 View commit details

Commits on Dec 31, 2017

  1. Docs: Add table of contents to Node.js API docs (#9785)

    Also standardize headers to ClassName#methodName so that it's easier to
    keep track of the context.
    Patrick McElhaney authored and platinumazure committed Dec 31, 2017
    Copy the full SHA
    61e5fa0 View commit details

Commits on Jan 4, 2018

  1. Copy the full SHA
    9fcfabf View commit details
  2. Update: More detailed assert message for rule-tester (#9769)

    * Update: More detailed assert message for rule-tester
    
    * [squash]add try/finally block
    
    * [squash]append message instead of overwriting it
    
    * [squash]add parentheses surrounding error message
    Weijia Wang authored and ilyavolodin committed Jan 4, 2018
    Copy the full SHA
    c64195f View commit details
  3. New: CLIEngine#getRules() (refs #6582) (#9782)

    Patrick McElhaney authored and ilyavolodin committed Jan 4, 2018
    Copy the full SHA
    65f0176 View commit details
  4. Docs: fix sort-imports rule block language (#9805)

    one of the blocks in rule `sort-imports`
    was missing language highlighting so
    added that as in two previous blocks.
    ferhatelmas authored and platinumazure committed Jan 4, 2018
    Copy the full SHA
    fc44da9 View commit details

Commits on Jan 5, 2018

  1. Docs: add url to each of the rules (refs #6582) (#9788)

    * Docs: add url to each of the rules (refs #6582)
    
    Code mod:
    
    export default function transformer(file, api) {
        const j = api.jscodeshift;
    
        const name = file.path.split('/').pop().replace(/.js$/, '');
    
        return j(file.source)
          .find(j.ObjectExpression)
          .filter(path => path.parentPath.node.key && path.parentPath.node.key.name === 'docs')
          .forEach(path => {
            const prop = j.property('init', j.identifier('url'), j.literal(`https://eslint.org/docs/rules/${name}`));
            j(path).replaceWith(j.objectExpression([...path.node.properties, prop]));
          })
          .toSource({lineTerminator: '\n'});
      }
    
    * New: internal-rules/consistent-docs-url (refs #6582)
    
    Add a lint rule to ensure that each rule has a meta.docs.url property with the correct value.
    Patrick McElhaney authored and ilyavolodin committed Jan 5, 2018
    Copy the full SHA
    fc7f404 View commit details

Commits on Jan 7, 2018

  1. New: Add context.report({ messageId }) (fixes #6740) (#9165)

    * New: Add context.report({ messageId }) (fixes #6740)
    
    * Chore: Extract out loop variables in rule-tester.js
    
    * New: RuleTester checks the messageId of expected errors
    
    * Chore: Extract the {{ }} substitutions into a separate file
    
    * Chore: Test interpolate()
    
    * Docs: document messageIds
    
    * Fix: Node 4 compatibility
    
    * Docs: Specify `node` in messageIds example
    
    * Update: Throw if a rule uses a messageId, but doesn’t have meta.messages
    
    * Fix: Don’t mutate the descriptor
    
    * Chore: Use hOP instead of Object.keys().indexOf
    
    * Docs: Add explanation for messageIds
    
    * Chore: Fix lint errors
    
    * Docs: Show how to use placeholders in messages
    j-f1 authored and kaicataldo committed Jan 7, 2018
    Copy the full SHA
    6ab04b5 View commit details
  2. Build: changelog update for 4.15.0

    ESLint Jenkins committed Jan 7, 2018
    Copy the full SHA
    2dfc3bd View commit details
  3. 4.15.0

    ESLint Jenkins committed Jan 7, 2018
    Copy the full SHA
    e14ceb0 View commit details
  4. Copy the full SHA
    54b329a View commit details

Commits on Jan 8, 2018

  1. Copy the full SHA
    ccfce15 View commit details
  2. Copy the full SHA
    acde640 View commit details
  3. Update: Rename and deprecate object-property-newline option (#9570)

    Object option allowMultiplePropertiesPerLine is stricter than the name implies.
    It creates an exception to object-property-newline only if ALL properties are
    on a SINGLE line. Renamed accordingly. Old name left deprecated, and 2 tests with
    deprecated name (1 valid and 1 invalid) left in force.
    jrpool authored and kaicataldo committed Jan 8, 2018
    Copy the full SHA
    2cf4522 View commit details

Commits on Jan 9, 2018

  1. Copy the full SHA
    b9da067 View commit details
Showing 2,183 changed files with 320,154 additions and 110,813 deletions.
13 changes: 13 additions & 0 deletions .c8rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"include": [
"bin/**/*.js",
"conf/**/*.js",
"lib/**/*.js"
],
"reporter": [
"lcov",
"text-summary",
"cobertura"
],
"sourceMap": true
}
5 changes: 4 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/build/**
/coverage/**
/docs/**
/docs/*
!/docs/*.js
!/docs/tools/
/jsdoc/**
/templates/**
/tests/bench/**
/tests/fixtures/**
/tests/performance/**
/tmp/**
/tools/internal-rules/node_modules/**
test.js
!.eslintrc.js
202 changes: 186 additions & 16 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,200 @@
/*
* IMPORTANT!
*
* Any changes made to this file must also be made to eslint.config.js.
*
* Internally, ESLint is using the eslint.config.js file to lint itself.
* This file is needed too, because:
*
* 1. ESLint VS Code extension expects eslintrc config files to be
* present to work correctly.
*
* Once we no longer need to support both eslintrc and flat config, we will
* remove this file.
*/


"use strict";

const path = require("path");
const rulesDirPlugin = require("eslint-plugin-rulesdir");

rulesDirPlugin.RULES_DIR = path.join(__dirname, "tools/internal-rules");
const INTERNAL_FILES = {
CLI_ENGINE_PATTERN: "lib/cli-engine/**/*",
LINTER_PATTERN: "lib/linter/**/*",
RULE_TESTER_PATTERN: "lib/rule-tester/**/*",
RULES_PATTERN: "lib/rules/**/*",
SOURCE_CODE_PATTERN: "lib/source-code/**/*"
};

/**
* Resolve an absolute path or glob pattern.
* @param {string} pathOrPattern the path or glob pattern.
* @returns {string} The resolved path or glob pattern.
*/
function resolveAbsolutePath(pathOrPattern) {
return path.resolve(__dirname, pathOrPattern);
}

/**
* Create an array of `no-restricted-require` entries for ESLint's core files.
* @param {string} [pattern] The glob pattern to create the entries for.
* @returns {Object[]} The array of `no-restricted-require` entries.
*/
function createInternalFilesPatterns(pattern = null) {
return Object.values(INTERNAL_FILES)
.filter(p => p !== pattern)
.map(p => ({
name: [

// Disallow all children modules.
resolveAbsolutePath(p),

// Allow the main `index.js` module.
`!${resolveAbsolutePath(p.replace(/\*\*\/\*$/u, "index.js"))}`
]
}));
}

module.exports = {
root: true,
plugins: [
"eslint-plugin",
"node",
"rulesdir"
"internal-rules"
],
extends: [
"./packages/eslint-config-eslint/default.yml",
"plugin:node/recommended",
"plugin:eslint-plugin/recommended"
"eslint/eslintrc"
],
parserOptions: {
ecmaVersion: 2021
},
rules: {
"eslint-plugin/consistent-output": "error",
"eslint-plugin/no-deprecated-context-methods": "error",
"eslint-plugin/prefer-output-null": "error",
"eslint-plugin/prefer-placeholders": "error",
"eslint-plugin/report-message-format": ["error", "[^a-z].*\\.$"],
"eslint-plugin/test-case-property-ordering": "error",
"eslint-plugin/test-case-shorthand-strings": "error",
"rulesdir/multiline-comment-style": "error"
}
"internal-rules/multiline-comment-style": "error"
},
overrides: [
{
files: ["tools/*.js", "docs/tools/*.js"],
rules: {
"no-console": "off",
"n/no-process-exit": "off"
}
},
{
files: ["lib/rules/*", "tools/internal-rules/*"],
excludedFiles: ["index.js"],
extends: [
"plugin:eslint-plugin/rules-recommended"
],
rules: {
"eslint-plugin/prefer-placeholders": "error",
"eslint-plugin/prefer-replace-text": "error",
"eslint-plugin/report-message-format": ["error", "[^a-z].*\\.$"],
"eslint-plugin/require-meta-docs-description": ["error", { pattern: "^(Enforce|Require|Disallow) .+[^. ]$" }],
"internal-rules/no-invalid-meta": "error"
}
},
{
files: ["lib/rules/*"],
excludedFiles: ["index.js"],
rules: {
"eslint-plugin/require-meta-docs-url": ["error", { pattern: "https://eslint.org/docs/latest/rules/{{name}}" }]
}
},
{
files: ["tests/lib/rules/*", "tests/tools/internal-rules/*"],
extends: [
"plugin:eslint-plugin/tests-recommended"
],
rules: {
"eslint-plugin/test-case-property-ordering": "error",
"eslint-plugin/test-case-shorthand-strings": "error"
}
},
{
files: ["tests/**/*"],
env: { mocha: true },
rules: {
"no-restricted-syntax": ["error", {
selector: "CallExpression[callee.object.name='assert'][callee.property.name='doesNotThrow']",
message: "`assert.doesNotThrow()` should be replaced with a comment next to the code."
}]
}
},

// Restrict relative path imports
{
files: ["lib/*"],
excludedFiles: ["lib/unsupported-api.js"],
rules: {
"n/no-restricted-require": ["error", [
...createInternalFilesPatterns()
]]
}
},
{
files: [INTERNAL_FILES.CLI_ENGINE_PATTERN],
rules: {
"n/no-restricted-require": ["error", [
...createInternalFilesPatterns(INTERNAL_FILES.CLI_ENGINE_PATTERN)
]]
}
},
{
files: [INTERNAL_FILES.LINTER_PATTERN],
rules: {
"n/no-restricted-require": ["error", [
...createInternalFilesPatterns(INTERNAL_FILES.LINTER_PATTERN),
"fs",
resolveAbsolutePath("lib/cli-engine/index.js"),
resolveAbsolutePath("lib/rule-tester/index.js")
]]
}
},
{
files: [INTERNAL_FILES.RULES_PATTERN],
rules: {
"n/no-restricted-require": ["error", [
...createInternalFilesPatterns(INTERNAL_FILES.RULES_PATTERN),
"fs",
resolveAbsolutePath("lib/cli-engine/index.js"),
resolveAbsolutePath("lib/linter/index.js"),
resolveAbsolutePath("lib/rule-tester/index.js"),
resolveAbsolutePath("lib/source-code/index.js")
]]
}
},
{
files: ["lib/shared/**/*"],
rules: {
"n/no-restricted-require": ["error", [
...createInternalFilesPatterns(),
resolveAbsolutePath("lib/cli-engine/index.js"),
resolveAbsolutePath("lib/linter/index.js"),
resolveAbsolutePath("lib/rule-tester/index.js"),
resolveAbsolutePath("lib/source-code/index.js")
]]
}
},
{
files: [INTERNAL_FILES.SOURCE_CODE_PATTERN],
rules: {
"n/no-restricted-require": ["error", [
...createInternalFilesPatterns(INTERNAL_FILES.SOURCE_CODE_PATTERN),
"fs",
resolveAbsolutePath("lib/cli-engine/index.js"),
resolveAbsolutePath("lib/linter/index.js"),
resolveAbsolutePath("lib/rule-tester/index.js"),
resolveAbsolutePath("lib/rules/index.js")
]]
}
},
{
files: [INTERNAL_FILES.RULE_TESTER_PATTERN],
rules: {
"n/no-restricted-require": ["error", [
...createInternalFilesPatterns(INTERNAL_FILES.RULE_TESTER_PATTERN),
resolveAbsolutePath("lib/cli-engine/index.js")
]]
}
}
]
};
6 changes: 5 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Convert text file line endings to lf
* text=auto

*.js text eol=lf
*.js text eol=lf

# The test fixtures are text files.
/tests/fixtures/**/* text eol=lf
/tests/fixtures/ignored-paths/crlf/.eslintignore text eol=crlf
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/docs/ @eslint/website-team @eslint/eslint-team
* @eslint/eslint-team
54 changes: 0 additions & 54 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

Loading