Skip to content

Commit 2b8b2df

Browse files
committed
fix: babel plugin not being configured properly for ts
1 parent a9d5951 commit 2b8b2df

File tree

4 files changed

+60
-57
lines changed

4 files changed

+60
-57
lines changed

packages/eslint-config/config/rules.js

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module.exports = {
1111
allowForLoopAfterthoughts: true,
1212
},
1313
],
14-
camelcase: 'off',
1514
'react/jsx-filename-extension': 'off',
1615
'react-hooks/rules-of-hooks': 'error',
1716
'react-hooks/exhaustive-deps': 'warn',
@@ -23,4 +22,55 @@ module.exports = {
2322
'func-names': 'off',
2423
'lines-between-class-members': 'off',
2524
'import/extensions': ['error', 'never'],
25+
// ===================================
26+
// Some rules from eslint-plugin-babel
27+
// ===================================
28+
// First turn them off
29+
'new-cap': 'off',
30+
camelcase: 'off',
31+
'no-invalid-this': 'off',
32+
'object-curly-spacing': 'off',
33+
semi: 'off',
34+
'no-unused-expressions': 'off',
35+
'valid-typeof': 'off',
36+
// require a capital letter for constructors
37+
'babel/new-cap': [
38+
'error',
39+
{
40+
newIsCap: true,
41+
newIsCapExceptions: [],
42+
capIsNew: false,
43+
capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'],
44+
},
45+
],
46+
// require camel case names
47+
// This one is enhanced from airbnb and accounts for destructuring
48+
// and react UNSAFE_component* methods.
49+
'babel/camelcase': [
50+
'error',
51+
{
52+
properties: 'never',
53+
ignoreDestructuring: true,
54+
},
55+
],
56+
// We would force invalid this rules
57+
// But would only warn about it
58+
'babel/no-invalid-this': 'warn',
59+
// We don't configure curly spacing because of prettier
60+
'babel/object-curly-spacing': 'off',
61+
// We don't configure babel/semi because of prettier
62+
'babel/semi': 'off',
63+
// disallow usage of expressions in statement position
64+
'babel/no-unused-expressions': [
65+
'error',
66+
{
67+
allowShortCircuit: false,
68+
allowTernary: false,
69+
allowTaggedTemplates: false,
70+
},
71+
],
72+
// ensure that the results of typeof are compared against a valid string
73+
// https://eslint.org/docs/rules/valid-typeof
74+
'babel/valid-typeof': ['error', { requireStringLiterals: true }],
75+
'no-unused-vars': 'warn',
2676
};

packages/eslint-config/index.js

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -23,60 +23,5 @@ module.exports = {
2323
plugins: ['babel', 'react-hooks'],
2424
rules: {
2525
...rules,
26-
// ===================================
27-
// Some rules from eslint-plugin-babel
28-
// ===================================
29-
// First turn them off
30-
'new-cap': 'off',
31-
camelcase: 'off',
32-
'no-invalid-this': 'off',
33-
'object-curly-spacing': 'off',
34-
semi: 'off',
35-
'no-unused-expressions': 'off',
36-
'valid-typeof': 'off',
37-
// require a capital letter for constructors
38-
'babel/new-cap': [
39-
'error',
40-
{
41-
newIsCap: true,
42-
newIsCapExceptions: [],
43-
capIsNew: false,
44-
capIsNewExceptions: [
45-
'Immutable.Map',
46-
'Immutable.Set',
47-
'Immutable.List',
48-
],
49-
},
50-
],
51-
// require camel case names
52-
// This one is enhanced from airbnb and accounts for destructuring
53-
// and react UNSAFE_component* methods.
54-
'babel/camelcase': [
55-
'error',
56-
{
57-
properties: 'never',
58-
ignoreDestructuring: true,
59-
},
60-
],
61-
// We would force invalid this rules
62-
// But would only warn about it
63-
'babel/no-invalid-this': 'warn',
64-
// We don't configure curly spacing because of prettier
65-
'babel/object-curly-spacing': 'off',
66-
// We don't configure babel/semi because of prettier
67-
'babel/semi': 'off',
68-
// disallow usage of expressions in statement position
69-
'babel/no-unused-expressions': [
70-
'error',
71-
{
72-
allowShortCircuit: false,
73-
allowTernary: false,
74-
allowTaggedTemplates: false,
75-
},
76-
],
77-
// ensure that the results of typeof are compared against a valid string
78-
// https://eslint.org/docs/rules/valid-typeof
79-
'babel/valid-typeof': ['error', { requireStringLiterals: true }],
80-
'no-unused-vars': 'warn',
8126
},
8227
};

packages/scripts/.eslintrc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = {
55
files: ['**/*.ts', '**/*.tsx'],
66
extends: ['@wpackio/eslint-config/ts'],
77
parserOptions: {
8-
project: './tsconfig.json',
8+
project: './tsconfig.eslint.json',
99
tsconfigRootDir: __dirname,
1010
},
1111
settings: {
@@ -17,6 +17,8 @@ module.exports = {
1717
},
1818
rules: {
1919
'no-console': 'off',
20+
'jest/no-conditional-expect': 'off',
21+
'@typescript-eslint/ban-ts-comment': 'off',
2022
},
2123
},
2224
],

site/docs/guides/changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@ shortTitle: Changelog
66

77
## VERSION 6.3.0
88

9+
#### `@wpackio/scripts`
10+
911
- **NEW** Option `useBabelConfig` in file config to override project-wide configuration for a particular entry.
1012
- **NEW** Option `compileNodeModules` in project config to handle how `node_modules` are compiled during production and development.
1113

14+
#### `@wpackio/eslint-config`
15+
16+
- **FIX** Babel plugin not being configured properly for typescript preset.
17+
1218
---
1319

1420
For previous changelogs, kindly visit our [GitHub Repo](https://github.com/swashata/wp-webpack-script/blob/master/CHANGELOG.md).

0 commit comments

Comments
 (0)