From 28337262bff8e57e4d9a4844f67f983a67cc5df1 Mon Sep 17 00:00:00 2001
From: Pierre-Marie Dartus
Date: Wed, 5 Dec 2018 13:47:19 -0800
Subject: [PATCH 1/3] Remove style config from package
---
style.js | 82 ---------------------------------------------------
test/style.js | 75 ----------------------------------------------
2 files changed, 157 deletions(-)
delete mode 100644 style.js
delete mode 100644 test/style.js
diff --git a/style.js b/style.js
deleted file mode 100644
index 855e798..0000000
--- a/style.js
+++ /dev/null
@@ -1,82 +0,0 @@
-'use strict';
-
-module.exports = {
- extends: [require.resolve('./lib/defaults')],
-
- rules: {
- // Best practices
- // https://eslint.org/docs/rules/#best-practices
- 'array-bracket-spacing': 'error',
- 'block-scoped-var': 'error',
- 'block-spacing': 'error',
- complexity: ['error', 24],
- 'computed-property-spacing': 'error',
- curly: ['error', 'all'],
- 'linebreak-style': 'error',
- 'new-cap': ['error', { capIsNewExceptionPattern: 'Mixin$' }],
- 'no-continue': 'error',
- 'no-lone-blocks': 'error',
- 'no-mixed-spaces-and-tabs': 'error',
- 'no-multiple-empty-lines': 'error',
- 'no-restricted-syntax': [
- 'error',
- {
- selector: 'LabeledStatement',
- message:
- 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
- },
- {
- selector: 'WithStatement',
- message:
- '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
- },
- ],
- 'no-tabs': 'error',
- 'operator-assignment': 'error',
- 'padded-blocks': ['error', 'never'],
- 'space-before-blocks': 'error',
- 'space-in-parens': 'error',
- 'space-infix-ops': 'error',
- 'spaced-comment': 'error',
- 'unicode-bom': 'error',
- yoda: ['error', 'never'],
-
- // Stylistic issues
- // https://eslint.org/docs/rules/#stylistic-issues
- 'brace-style': ['error', '1tbs'],
- camelcase: ['error', { allow: ['.+__.+'] }],
- 'comma-spacing': 'error',
- 'comma-style': 'error',
- 'consistent-this': ['error', 'that'],
- 'func-call-spacing': 'error',
- 'keyword-spacing': 'error',
- 'no-lonely-if': 'error',
- 'no-mixed-operators': 'error',
- 'space-before-function-paren': [
- 'error',
- {
- anonymous: 'always',
- named: 'never',
- asyncArrow: 'always',
- },
- ],
- 'no-trailing-spaces': 'error',
- 'semi-spacing': ['error', { before: false, after: true }],
- semi: 'error',
- 'space-unary-ops': ['error', { words: true, nonwords: false }],
-
- // ES6
- // https://eslint.org/docs/rules/#ecmascript-6
- 'arrow-spacing': 'error',
- 'generator-star-spacing': 'error',
- 'no-var': 'error',
- 'object-shorthand': 'error',
- 'prefer-arrow-callback': 'error',
- 'prefer-const': 'error',
- 'prefer-numeric-literals': 'error',
- 'rest-spread-spacing': 'error',
- 'symbol-description': 'error',
- 'template-curly-spacing': 'error',
- 'yield-star-spacing': 'error',
- },
-};
diff --git a/test/style.js b/test/style.js
deleted file mode 100644
index aa75e02..0000000
--- a/test/style.js
+++ /dev/null
@@ -1,75 +0,0 @@
-'use strict';
-
-const assert = require('assert');
-const eslint = require('eslint');
-
-const { linkConfig, unlinkConfig } = require('./utils');
-
-describe('extended config', () => {
- before(() => {
- linkConfig();
- });
-
- after(() => {
- unlinkConfig();
- });
-
- it('should load properly style config', () => {
- const cli = new eslint.CLIEngine({
- useEslintrc: false,
- baseConfig: {
- extends: '@salesforce/eslint-config-lwc/style',
- },
- });
-
- const report = cli.executeOnText(`const foo_bar = 1;`);
-
- const { messages } = report.results[0];
- assert.equal(messages.length, 1);
- assert.equal(messages[0].ruleId, 'camelcase');
- });
-
- it('should not report camelcase error for Salesforce identifiers', () => {
- const cli = new eslint.CLIEngine({
- useEslintrc: false,
- baseConfig: {
- extends: '@salesforce/eslint-config-lwc/style',
- },
- });
-
- const report = cli.executeOnText(
- [
- 'const Foo = 1;',
- 'const FooBar = 1;',
- 'const FooBar__c = 1;',
- 'const FooBar__baz = 1;',
- 'const FooBar__bazBuz = 1;',
- 'const FooBar__baz_buz = 1;',
- 'const FooBar_c = 1;',
- ].join('\n'),
- );
-
- const { messages } = report.results[0];
- assert.equal(messages.length, 1);
- assert.equal(messages[0].ruleId, 'camelcase');
- });
-
- it('should not report new-cap error for mixins', () => {
- const cli = new eslint.CLIEngine({
- useEslintrc: false,
- baseConfig: {
- extends: '@salesforce/eslint-config-lwc/style',
- },
- });
-
- const report = cli.executeOnText(
- [`class Foo extends SomeMixin(Base) {}`, `class Foo extends Wrapper(Base) {}`].join(
- '\n',
- ),
- );
-
- const { messages } = report.results[0];
- assert.equal(messages.length, 1);
- assert.equal(messages[0].ruleId, 'new-cap');
- });
-});
From f0204f19b4fc4466c08a419105c024cd730e5394 Mon Sep 17 00:00:00 2001
From: Pierre-Marie Dartus
Date: Wed, 5 Dec 2018 13:48:55 -0800
Subject: [PATCH 2/3] Update README.md
---
README.md | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index 20645e9..cb4a7ec 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ Example of `.eslintrc`:
```json
{
- "extends": ["@salesforce/eslint-config-lwc/recommended", "@salesforce/eslint-config-lwc/style"]
+ "extends": ["@salesforce/eslint-config-lwc/recommended"]
}
```
@@ -24,7 +24,7 @@ For more details about configuration please refer to the dedicated section in th
## Configurations
-This package exposes 4 configurations for your usage.
+This package exposes 3 configurations for your usage.
### `@salesforce/eslint-config-lwc/base` configuration
@@ -45,15 +45,7 @@ Prevent common Javascript pitfalls and enforces all best practices.
### `@salesforce/eslint-config-lwc/extended` configuration
**Goal:**
-Restrict usage of some Javascript language features known to be slow after the _COMPAT_ transformation. LWC runs in _COMPAT_ mode on older browsers (eg. IE11). To support new Javascript syntax and language features on older browser the LWC compiler transforms LWC modules. This linting configuraton targets patterns known to be slow in _COMPAT_ mode..
+Restrict usage of some Javascript language features known to be slow after the _COMPAT_ transformation. LWC runs in _COMPAT_ mode on older browsers (eg. IE11). To support new Javascript syntax and language features on older browser the LWC compiler transforms LWC modules. This linting configuration targets patterns known to be slow in _COMPAT_ mode.
**Rules:**
`@salesforce/eslint-config-lwc/recommended` rules + restrict usage of some slow patterns in _COMPAT_.
-
-### `@salesforce/eslint-config-lwc/style` configuration
-
-**Goal:**
-Enforces Salesforce code style rules for LWC modules.
-
-**Rules:**
-Some of the [Stylistic Issues](https://eslint.org/docs/rules/#stylistic-issues) and [_Best Practices_](https://eslint.org/docs/rules/#best-practices) rules.
From 42c5931118689060361e79e29cba59eb04b328d0 Mon Sep 17 00:00:00 2001
From: Pierre-Marie Dartus
Date: Wed, 5 Dec 2018 13:49:16 -0800
Subject: [PATCH 3/3] Remove style.js from the list of published files
---
package.json | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/package.json b/package.json
index 42b73d1..9b74b02 100644
--- a/package.json
+++ b/package.json
@@ -39,8 +39,7 @@
"base.js",
"extended.js",
"index.js",
- "recommended.js",
- "style.js"
+ "recommended.js"
],
"husky": {
"hooks": {