From dce1c8059b2aa4231798d0a9b4443e91e4eac497 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Sat, 11 Apr 2020 15:56:06 +0800 Subject: [PATCH] - Add `meta.type` to rules ("layout" for all rules but `no-callback-literal` which is set to "suggestion") - Adhere to standard linting on README example - Add `.editorconfig` to prep. IDEs for proper indentation before lint checking/fixing --- .editorconfig | 12 ++++++++++++ README.md | 11 +++++------ rules/array-bracket-even-spacing.js | 1 + rules/computed-property-even-spacing.js | 1 + rules/no-callback-literal.js | 1 + rules/object-curly-even-spacing.js | 1 + 6 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c6812c1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +; EditorConfig file: https://EditorConfig.org +; Install the "EditorConfig" plugin into your editor to use + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true diff --git a/README.md b/README.md index 8f4aba8..88842fc 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,12 @@ ESlint Rules for the Standard Linter ### Configuration ```js -{ +module.exports = { rules: { - 'standard/object-curly-even-spacing': [2, "either"], - 'standard/array-bracket-even-spacing': [2, "either"], - 'standard/computed-property-even-spacing': [2, "even"], - 'standard/no-callback-literal': [2, ["cb", "callback"]] + 'standard/object-curly-even-spacing': [2, 'either'], + 'standard/array-bracket-even-spacing': [2, 'either'], + 'standard/computed-property-even-spacing': [2, 'even'], + 'standard/no-callback-literal': [2, ['cb', 'callback']] } } ``` @@ -36,4 +36,3 @@ There are several rules that were created specifically for the `standard` linter - `array-bracket-even-spacing` - Like `array-bracket-even-spacing` from ESLint except it has an `either` option which lets you have 1 or 0 spacing padding. - `computed-property-even-spacing` - Like `computed-property-spacing` around ESLint except is has an `even` option which lets you have 1 or 0 spacing padding. - `no-callback-literal` - Ensures that we strictly follow the callback pattern with `undefined`, `null` or an error object in the first position of a callback. - diff --git a/rules/array-bracket-even-spacing.js b/rules/array-bracket-even-spacing.js index ca2053d..898351b 100644 --- a/rules/array-bracket-even-spacing.js +++ b/rules/array-bracket-even-spacing.js @@ -14,6 +14,7 @@ module.exports = { meta: { + type: 'layout', docs: { url: 'https://github.com/standard/eslint-plugin-standard#rules-explanations' } diff --git a/rules/computed-property-even-spacing.js b/rules/computed-property-even-spacing.js index 150eb42..b21656c 100644 --- a/rules/computed-property-even-spacing.js +++ b/rules/computed-property-even-spacing.js @@ -11,6 +11,7 @@ module.exports = { meta: { + type: 'layout', docs: { url: 'https://github.com/standard/eslint-plugin-standard#rules-explanations' } diff --git a/rules/no-callback-literal.js b/rules/no-callback-literal.js index 16f0b9f..db3f617 100644 --- a/rules/no-callback-literal.js +++ b/rules/no-callback-literal.js @@ -48,6 +48,7 @@ function couldBeError (node) { module.exports = { meta: { + type: 'suggestion', docs: { url: 'https://github.com/standard/eslint-plugin-standard#rules-explanations' } diff --git a/rules/object-curly-even-spacing.js b/rules/object-curly-even-spacing.js index dcfc9a2..eccb4fb 100644 --- a/rules/object-curly-even-spacing.js +++ b/rules/object-curly-even-spacing.js @@ -14,6 +14,7 @@ module.exports = { meta: { + type: 'layout', docs: { url: 'https://github.com/standard/eslint-plugin-standard#rules-explanations' }