Skip to content

Commit

Permalink
Update rules to use 'layout' instead of 'style'
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Nov 1, 2018
1 parent fef4f9a commit b4ed91f
Show file tree
Hide file tree
Showing 87 changed files with 179 additions and 176 deletions.
2 changes: 1 addition & 1 deletion docs/developer-guide/nodejs-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ The `CLIEngine` is a constructor, and you can create a new instance by passing i
* `envs` - An array of environments to load (default: empty array). Corresponds to `--env`.
* `extensions` - An array of filename extensions that should be checked for code. The default is an array containing just `".js"`. Corresponds to `--ext`. It is only used in conjunction with directories, not with filenames or glob patterns.
* `fix` - A boolean or a function (default: `false`). If a function, it will be passed each linting message and should return a boolean indicating whether the fix should be included with the output report (errors and warnings will not be listed if fixed). Files on disk are never changed regardless of the value of `fix`. To persist changes to disk, call [`outputFixes()`](#cliengineoutputfixes).
* `fixTypes` - An array of rule types for which fixes should be applied (default: `null`). This array acts like a filter, only allowing rules of the given types to apply fixes. Possible array values are `"problem"`, `"suggestion"`, and `"style"`.
* `fixTypes` - An array of rule types for which fixes should be applied (default: `null`). This array acts like a filter, only allowing rules of the given types to apply fixes. Possible array values are `"problem"`, `"suggestion"`, and `"layout"`.
* `globals` - An array of global variables to declare (default: empty array). Corresponds to `--global`.
* `ignore` - False disables use of `.eslintignore`, `ignorePath` and `ignorePattern` (default: true). Corresponds to `--no-ignore`.
* `ignorePath` - The ignore file to use instead of `.eslintignore` (default: null). Corresponds to `--ignore-path`.
Expand Down
5 changes: 4 additions & 1 deletion docs/developer-guide/working-with-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ The source file for a rule exports an object with the following properties.

`meta` (object) contains metadata for the rule:

* `type` (string) indicates the type of rule, which is one of `"problem"`, `"suggestion"`, or `"style"`
* `type` (string) indicates the type of rule, which is one of `"problem"`, `"suggestion"`, or `"layout"`:
* `"problem"` means the rule is identifying code that either will cause an error or may cause a confusing behavior. Developers should consider this a high priority to resolve.
* `"suggestion"` means the rule is identifying something that could be done in a better way but no errors will occur if the code isn't changed.
* `"layout"` means the rule cares primarily about whitespace, semicolons, commas, and parentheses, all the parts of the program that determine how the code looks rather than how it executes. These rules work on parts of the code that aren't specified in the AST.

* `docs` (object) is required for core rules of ESLint:

Expand Down
8 changes: 4 additions & 4 deletions docs/user-guide/command-line-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Specifying rules and plugins:
Fixing problems:
--fix Automatically fix problems
--fix-dry-run Automatically fix problems without saving the changes to the file system
--fix-type Array Specify the types of fixes to apply (problem, suggestion, style)
--fix-type Array Specify the types of fixes to apply (problem, suggestion, layout)
Ignoring files:
--ignore-path path::String Specify path of ignore file
Expand Down Expand Up @@ -240,17 +240,17 @@ This option allows you to specify the type of fixes to apply when using either `

1. `problem` - fix potential errors in the code
1. `suggestion` - apply fixes to the code that improve it
1. `style` - apply fixes that do not mutate the program structure (AST)
1. `layout` - apply fixes that do not change the program structure (AST)

You can specify one or more fix type on the command line. Here are some examples:

```
eslint --fix --fix-type suggestion .
eslint --fix --fix-type suggestion --fix-type problem .
eslint --fix --fix-type suggestion,style .
eslint --fix --fix-type suggestion,layout .
```

This option is helpful if you are using another program to style your code but you would still like ESLint to apply other types of fixes.
This option is helpful if you are using another program to format your code but you would still like ESLint to apply other types of fixes.

### Ignoring files

Expand Down
2 changes: 1 addition & 1 deletion lib/cli-engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const fs = require("fs"),

const debug = require("debug")("eslint:cli-engine");
const resolver = new ModuleResolver();
const validFixTypes = new Set(["problem", "suggestion", "style"]);
const validFixTypes = new Set(["problem", "suggestion", "layout"]);

//------------------------------------------------------------------------------
// Typedefs
Expand Down
2 changes: 1 addition & 1 deletion lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ module.exports = optionator({
{
option: "fix-type",
type: "Array",
description: "Specify the types of fixes to apply (problem, suggestion, style)"
description: "Specify the types of fixes to apply (problem, suggestion, layout)"
},
{
heading: "Ignoring files"
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/array-bracket-newline.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce linebreaks after opening and before closing array brackets",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/array-bracket-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce consistent spacing inside array brackets",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/array-element-newline.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce line breaks after each array element",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/arrow-parens.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "require parentheses around arrow function arguments",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/arrow-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce consistent spacing before and after the arrow in arrow functions",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/block-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const util = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "disallow or enforce spaces inside of blocks after opening block and before closing block",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/brace-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce consistent brace style for blocks",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/comma-dangle.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function normalizeOptions(optionValue) {

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "require or disallow trailing commas",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/comma-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce consistent spacing before and after commas",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/comma-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce consistent comma style",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/computed-property-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce consistent spacing inside computed property brackets",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/dot-location.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce consistent newlines before and after dots",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/eol-last.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const lodash = require("lodash");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "require or disallow newline at the end of files",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/func-call-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "require or disallow spacing between function identifiers and their invocations",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/func-name-matching.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const optionsObject = {

module.exports = {
meta: {
type: "style",
type: "suggestion",

docs: {
description: "require function names to match the name of the variable or property to which they are assigned",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/func-names.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function isFunctionName(variable) {

module.exports = {
meta: {
type: "style",
type: "suggestion",

docs: {
description: "require or disallow named `function` expressions",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/function-paren-newline.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce consistent line breaks inside function parentheses",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/generator-star-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const OVERRIDE_SCHEMA = {

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce consistent spacing around `*` operators in generator functions",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/id-blacklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

module.exports = {
meta: {
type: "style",
type: "suggestion",

docs: {
description: "disallow specified identifiers",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/id-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

module.exports = {
meta: {
type: "style",
type: "suggestion",

docs: {
description: "enforce minimum and maximum identifier lengths",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/id-match.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

module.exports = {
meta: {
type: "style",
type: "suggestion",

docs: {
description: "require identifiers to match a specified regular expression",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/implicit-arrow-linebreak.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//------------------------------------------------------------------------------
module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce the location of arrow function bodies",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/indent-legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const astUtils = require("../util/ast-utils");
/* istanbul ignore next: this rule has known coverage issues, but it's deprecated and shouldn't be updated in the future anyway. */
module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce consistent indentation",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/indent.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ const ELEMENT_LIST_SCHEMA = {

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce consistent indentation",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/jsx-quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const QUOTE_SETTINGS = {

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce the consistent use of either double or single quotes in JSX attributes",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/key-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const messages = {

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce consistent spacing between keys and values in object literal properties",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/keyword-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function isCloseParenOfTemplate(token) {

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce consistent spacing before and after keywords",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/line-comment-position.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce position of line comments",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/linebreak-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce consistent linebreak style",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/lines-around-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function getCommentLineNums(comments) {

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "require empty lines around comments",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/lines-around-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "require or disallow newlines around directives",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/lines-between-class-members.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "require or disallow an empty line between class members",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/max-len.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const OPTIONS_OR_INTEGER_SCHEMA = {

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce a maximum line length",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/max-statements-per-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce a maximum number of statements allowed per line",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/multiline-ternary.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const astUtils = require("../util/ast-utils");

module.exports = {
meta: {
type: "style",
type: "layout",

docs: {
description: "enforce newlines between operands of ternary expressions",
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/new-cap.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function calculateCapIsNewExceptions(config) {

module.exports = {
meta: {
type: "style",
type: "suggestion",

docs: {
description: "require constructor names to begin with a capital letter",
Expand Down

0 comments on commit b4ed91f

Please sign in to comment.