@modern-js-app/eslint-config 1.2.1 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/{eslintrc.js → base.js} +9 -468
- package/index.js +4 -1
- package/lite.js +4 -0
- package/package.json +4 -4
- package/prettier.js +26 -0
- package/ts.js +405 -0
- package/ts.withType.js +61 -0
- package/eslintrc.prettier.js +0 -83
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @modern-js-app/eslint-config
|
|
2
2
|
|
|
3
|
+
## 1.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 87e68464: refactor: eslint rule configs
|
|
8
|
+
|
|
9
|
+
## 1.2.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- b44c02d4: fix: remove no-invalid-void-type rule
|
|
14
|
+
|
|
15
|
+
## 1.2.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- c35f710a: fix: typescript version warning when running lint
|
|
20
|
+
|
|
3
21
|
## 1.2.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/{eslintrc.js → base.js}
RENAMED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* eslint-disable max-lines, no-magic-numbers */
|
|
2
|
-
// const path = require('path');
|
|
3
2
|
|
|
4
3
|
const { jsExtensions } = require('./utils');
|
|
5
4
|
|
|
@@ -10,7 +9,6 @@ module.exports = {
|
|
|
10
9
|
ecmaVersion: 8,
|
|
11
10
|
ecmaFeatures: {
|
|
12
11
|
impliedStrict: true,
|
|
13
|
-
ecmaVersion: 2018,
|
|
14
12
|
jsx: true,
|
|
15
13
|
},
|
|
16
14
|
sourceType: 'module',
|
|
@@ -23,8 +21,9 @@ module.exports = {
|
|
|
23
21
|
// https://eslint.org/docs/user-guide/configuring#specifying-environments
|
|
24
22
|
env: {
|
|
25
23
|
es6: true,
|
|
24
|
+
commonjs: false,
|
|
26
25
|
'shared-node-browser': true,
|
|
27
|
-
browser:
|
|
26
|
+
browser: true,
|
|
28
27
|
node: false,
|
|
29
28
|
worker: false,
|
|
30
29
|
serviceworker: false,
|
|
@@ -35,8 +34,6 @@ module.exports = {
|
|
|
35
34
|
globals: { gql: 'readable' },
|
|
36
35
|
// https://eslint.org/docs/user-guide/configuring#configuring-plugins
|
|
37
36
|
plugins: [
|
|
38
|
-
// https://www.npmjs.com/package/eslint-plugin-prettier
|
|
39
|
-
'prettier',
|
|
40
37
|
// https://www.npmjs.com/package/@babel/eslint-plugin
|
|
41
38
|
'@babel',
|
|
42
39
|
// https://www.npmjs.com/package/eslint-plugin-react
|
|
@@ -1813,469 +1810,6 @@ module.exports = {
|
|
|
1813
1810
|
// https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns
|
|
1814
1811
|
// https://eslint.org/docs/user-guide/migrating-to-6.0.0#-overrides-in-an-extended-config-file-can-now-be-overridden-by-a-parent-config-file
|
|
1815
1812
|
overrides: [
|
|
1816
|
-
{
|
|
1817
|
-
files: ['*.ts', '*.d.ts', '*.tsx'],
|
|
1818
|
-
|
|
1819
|
-
/*
|
|
1820
|
-
* https://eslint.org/blog/2019/01/future-typescript-eslint
|
|
1821
|
-
* https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser
|
|
1822
|
-
*/
|
|
1823
|
-
parser: '@typescript-eslint/parser',
|
|
1824
|
-
parserOptions: {
|
|
1825
|
-
ecmaFeatures: { jsx: true },
|
|
1826
|
-
project: ['./tsconfig.json', './packages/*/tsconfig.json'],
|
|
1827
|
-
// createDefaultProgram: true,
|
|
1828
|
-
// project: 'node_modules/@modern/config/defaults/tsconfig.json',
|
|
1829
|
-
// tsconfigRootDir: path.resolve(
|
|
1830
|
-
// path.dirname(require.resolve('eslint/package.json')),
|
|
1831
|
-
// '../..',
|
|
1832
|
-
// ),
|
|
1833
|
-
},
|
|
1834
|
-
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin
|
|
1835
|
-
plugins: [
|
|
1836
|
-
'@typescript-eslint',
|
|
1837
|
-
// 'tsdoc'
|
|
1838
|
-
],
|
|
1839
|
-
// @BUG
|
|
1840
|
-
// extends: ['plugin:@typescript-eslint/recommended'],
|
|
1841
|
-
// https://github.com/benmosher/eslint-plugin-import/blob/master/config/typescript.js
|
|
1842
|
-
settings: {
|
|
1843
|
-
'import/external-module-folders': [
|
|
1844
|
-
'node_modules',
|
|
1845
|
-
'node_modules/@types',
|
|
1846
|
-
],
|
|
1847
|
-
'import/parsers': {
|
|
1848
|
-
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
|
|
1849
|
-
},
|
|
1850
|
-
'import/resolver': { node: { extensions: jsExtensions } },
|
|
1851
|
-
},
|
|
1852
|
-
rules: {
|
|
1853
|
-
// https://github.com/benmosher/eslint-plugin-import/blob/master/config/typescript.js
|
|
1854
|
-
'import/named': 'off',
|
|
1855
|
-
camelcase: 'off',
|
|
1856
|
-
indent: 'off',
|
|
1857
|
-
'no-unused-vars': 'off',
|
|
1858
|
-
'no-use-before-define': 'off',
|
|
1859
|
-
// type A = { foo: string; }; export { A };
|
|
1860
|
-
'no-undef': 'off',
|
|
1861
|
-
'prefer-named-capture-group': 'off',
|
|
1862
|
-
'no-useless-constructor': 'off',
|
|
1863
|
-
'no-array-constructor': 'off',
|
|
1864
|
-
'func-call-spacing': 'off',
|
|
1865
|
-
// @BUG no ignore
|
|
1866
|
-
'no-magic-numbers': 'off',
|
|
1867
|
-
semi: 'off',
|
|
1868
|
-
'no-empty-function': 'off',
|
|
1869
|
-
'equire-await': 'off',
|
|
1870
|
-
'require-await': 'off',
|
|
1871
|
-
'one-var': ['error', 'never'],
|
|
1872
|
-
// 'jsdoc/no-types': 'error',
|
|
1873
|
-
'react/require-default-props': 'off',
|
|
1874
|
-
// 'jsdoc/check-tag-names': 'off',
|
|
1875
|
-
// https://github.com/microsoft/tsdoc/tree/master/eslint-plugin
|
|
1876
|
-
// 'tsdoc/syntax': 'warn',
|
|
1877
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md
|
|
1878
|
-
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
1879
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md
|
|
1880
|
-
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
1881
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/array-type.md
|
|
1882
|
-
'@typescript-eslint/array-type': 'off',
|
|
1883
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/await-thenable.md
|
|
1884
|
-
'@typescript-eslint/await-thenable': 'error',
|
|
1885
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-comment.md
|
|
1886
|
-
'@typescript-eslint/ban-ts-comment': [
|
|
1887
|
-
'error',
|
|
1888
|
-
{
|
|
1889
|
-
'ts-expect-error': true,
|
|
1890
|
-
'ts-ignore': true,
|
|
1891
|
-
'ts-nocheck': true,
|
|
1892
|
-
'ts-check': false,
|
|
1893
|
-
},
|
|
1894
|
-
],
|
|
1895
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md
|
|
1896
|
-
'@typescript-eslint/ban-types': 'error',
|
|
1897
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-comment.md
|
|
1898
|
-
'@typescript-eslint/ban-tslint-comment': 'error',
|
|
1899
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/class-literal-property-style.md
|
|
1900
|
-
'@typescript-eslint/class-literal-property-style': ['error', 'fields'],
|
|
1901
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md
|
|
1902
|
-
'@typescript-eslint/consistent-indexed-object-style': 'off',
|
|
1903
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-assertions.md
|
|
1904
|
-
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
1905
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-definitions.md
|
|
1906
|
-
'@typescript-eslint/consistent-type-definitions': 'off',
|
|
1907
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-imports.md
|
|
1908
|
-
'@typescript-eslint/consistent-type-imports': 'off',
|
|
1909
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
|
|
1910
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
1911
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
|
|
1912
|
-
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
1913
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md
|
|
1914
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
1915
|
-
'@typescript-eslint/indent': [
|
|
1916
|
-
'error',
|
|
1917
|
-
2,
|
|
1918
|
-
{
|
|
1919
|
-
SwitchCase: 1,
|
|
1920
|
-
VariableDeclarator: 'first',
|
|
1921
|
-
outerIIFEBody: 0,
|
|
1922
|
-
MemberExpression: 1,
|
|
1923
|
-
FunctionDeclaration: { parameters: 'first' },
|
|
1924
|
-
FunctionExpression: { parameters: 'first' },
|
|
1925
|
-
CallExpression: { arguments: 'first' },
|
|
1926
|
-
ArrayExpression: 1,
|
|
1927
|
-
ObjectExpression: 1,
|
|
1928
|
-
ImportDeclaration: 1,
|
|
1929
|
-
flatTernaryExpressions: false,
|
|
1930
|
-
},
|
|
1931
|
-
],
|
|
1932
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-delimiter-style.md
|
|
1933
|
-
'@typescript-eslint/member-delimiter-style': [
|
|
1934
|
-
'error',
|
|
1935
|
-
{
|
|
1936
|
-
multiline: {
|
|
1937
|
-
delimiter: 'semi',
|
|
1938
|
-
requireLast: true,
|
|
1939
|
-
},
|
|
1940
|
-
singleline: {
|
|
1941
|
-
delimiter: 'semi',
|
|
1942
|
-
requireLast: true,
|
|
1943
|
-
},
|
|
1944
|
-
},
|
|
1945
|
-
],
|
|
1946
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.md
|
|
1947
|
-
'@typescript-eslint/member-ordering': [
|
|
1948
|
-
'error',
|
|
1949
|
-
{
|
|
1950
|
-
default: [
|
|
1951
|
-
'public-static-field',
|
|
1952
|
-
'protected-static-field',
|
|
1953
|
-
'private-static-field',
|
|
1954
|
-
'static-field',
|
|
1955
|
-
'public-static-method',
|
|
1956
|
-
'protected-static-method',
|
|
1957
|
-
'private-static-method',
|
|
1958
|
-
'static-method',
|
|
1959
|
-
'public-instance-field',
|
|
1960
|
-
'protected-instance-field',
|
|
1961
|
-
'private-instance-field',
|
|
1962
|
-
'instance-field',
|
|
1963
|
-
'public-field',
|
|
1964
|
-
'protected-field',
|
|
1965
|
-
'private-field',
|
|
1966
|
-
'field',
|
|
1967
|
-
'constructor',
|
|
1968
|
-
// 'public-instance-method',
|
|
1969
|
-
// 'protected-instance-method',
|
|
1970
|
-
// 'private-instance-method',
|
|
1971
|
-
'instance-method',
|
|
1972
|
-
// 'public-method',
|
|
1973
|
-
// 'protected-method',
|
|
1974
|
-
// 'private-method',
|
|
1975
|
-
'method',
|
|
1976
|
-
],
|
|
1977
|
-
},
|
|
1978
|
-
],
|
|
1979
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/method-signature-style.md
|
|
1980
|
-
'@typescript-eslint/method-signature-style': 'error',
|
|
1981
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
|
|
1982
|
-
'@typescript-eslint/naming-convention': [
|
|
1983
|
-
'error',
|
|
1984
|
-
{
|
|
1985
|
-
selector: 'default',
|
|
1986
|
-
format: ['camelCase', 'PascalCase', 'UPPER_CASE', 'snake_case'],
|
|
1987
|
-
leadingUnderscore: 'allowSingleOrDouble',
|
|
1988
|
-
trailingUnderscore: 'allowSingleOrDouble',
|
|
1989
|
-
},
|
|
1990
|
-
|
|
1991
|
-
{
|
|
1992
|
-
selector: 'variable',
|
|
1993
|
-
format: ['camelCase', 'PascalCase', 'UPPER_CASE', 'snake_case'],
|
|
1994
|
-
leadingUnderscore: 'allowSingleOrDouble',
|
|
1995
|
-
trailingUnderscore: 'allowSingleOrDouble',
|
|
1996
|
-
},
|
|
1997
|
-
|
|
1998
|
-
{
|
|
1999
|
-
selector: 'typeLike',
|
|
2000
|
-
format: ['PascalCase'],
|
|
2001
|
-
},
|
|
2002
|
-
],
|
|
2003
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md
|
|
2004
|
-
'@typescript-eslint/no-array-constructor': 'error',
|
|
2005
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-interface.md
|
|
2006
|
-
'@typescript-eslint/no-empty-interface': 'error',
|
|
2007
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md
|
|
2008
|
-
// @TODO disable?
|
|
2009
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
2010
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extraneous-class.md
|
|
2011
|
-
'@typescript-eslint/no-extraneous-class': 'error',
|
|
2012
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-for-in-array.md
|
|
2013
|
-
'@typescript-eslint/no-for-in-array': 'error',
|
|
2014
|
-
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
|
|
2015
|
-
'@typescript-eslint/no-implicit-any-catch': 'off',
|
|
2016
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-invalid-void-type.md
|
|
2017
|
-
'@typescript-eslint/no-invalid-void-type': 'error',
|
|
2018
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-inferrable-types.md
|
|
2019
|
-
'@typescript-eslint/no-inferrable-types': [
|
|
2020
|
-
'error',
|
|
2021
|
-
{ ignoreProperties: true },
|
|
2022
|
-
],
|
|
2023
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-misused-new.md
|
|
2024
|
-
'@typescript-eslint/no-misused-new': 'error',
|
|
2025
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-namespace.md
|
|
2026
|
-
'@typescript-eslint/no-namespace': 'error',
|
|
2027
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-base-to-string.md
|
|
2028
|
-
'@typescript-eslint/no-base-to-string': 'error',
|
|
2029
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md
|
|
2030
|
-
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
|
|
2031
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-confusing-void-expression.md
|
|
2032
|
-
'@typescript-eslint/no-confusing-void-expression': 'off',
|
|
2033
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-assertion.md
|
|
2034
|
-
// @feedback 在 middleware 下,如果有些参数是 optional 的,会在上一层被拦截掉,下一层一定会有这个参数
|
|
2035
|
-
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
2036
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md
|
|
2037
|
-
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
|
2038
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-parameter-properties.md
|
|
2039
|
-
'@typescript-eslint/no-parameter-properties': 'error',
|
|
2040
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-require-imports.md
|
|
2041
|
-
'@typescript-eslint/no-require-imports': 'error',
|
|
2042
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-this-alias.md
|
|
2043
|
-
'@typescript-eslint/no-this-alias': [
|
|
2044
|
-
'error',
|
|
2045
|
-
{ allowDestructuring: true },
|
|
2046
|
-
],
|
|
2047
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-type-alias.md
|
|
2048
|
-
'@typescript-eslint/no-type-alias': 'off',
|
|
2049
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md
|
|
2050
|
-
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
|
2051
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md
|
|
2052
|
-
'@typescript-eslint/no-unnecessary-condition': 'off',
|
|
2053
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-qualifier.md
|
|
2054
|
-
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
2055
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md
|
|
2056
|
-
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
2057
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md
|
|
2058
|
-
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
|
2059
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md
|
|
2060
|
-
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
2061
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unsafe-call.md
|
|
2062
|
-
'@typescript-eslint/no-unsafe-call': 'off',
|
|
2063
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md
|
|
2064
|
-
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
2065
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unsafe-return.md
|
|
2066
|
-
'@typescript-eslint/no-unsafe-return': 'off',
|
|
2067
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
|
|
2068
|
-
'@typescript-eslint/no-unused-vars': [
|
|
2069
|
-
'error',
|
|
2070
|
-
{
|
|
2071
|
-
vars: 'all',
|
|
2072
|
-
args: 'after-used',
|
|
2073
|
-
ignoreRestSiblings: true,
|
|
2074
|
-
argsIgnorePattern: '^_',
|
|
2075
|
-
caughtErrors: 'none',
|
|
2076
|
-
},
|
|
2077
|
-
],
|
|
2078
|
-
'@babel/no-unused-expressions': 'off',
|
|
2079
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
|
|
2080
|
-
'@typescript-eslint/no-unused-expressions': [
|
|
2081
|
-
'error',
|
|
2082
|
-
{
|
|
2083
|
-
allowShortCircuit: true,
|
|
2084
|
-
allowTernary: false,
|
|
2085
|
-
allowTaggedTemplates: true,
|
|
2086
|
-
},
|
|
2087
|
-
],
|
|
2088
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
|
|
2089
|
-
'@typescript-eslint/no-use-before-define': [
|
|
2090
|
-
'error',
|
|
2091
|
-
{
|
|
2092
|
-
functions: false,
|
|
2093
|
-
classes: false,
|
|
2094
|
-
variables: false,
|
|
2095
|
-
},
|
|
2096
|
-
],
|
|
2097
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
|
|
2098
|
-
'@typescript-eslint/no-useless-constructor': 'error',
|
|
2099
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-var-requires.md
|
|
2100
|
-
'@typescript-eslint/no-var-requires': 'error',
|
|
2101
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-as-const.md
|
|
2102
|
-
'@typescript-eslint/prefer-as-const': 'error',
|
|
2103
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md
|
|
2104
|
-
'@typescript-eslint/prefer-enum-initializers': 'off',
|
|
2105
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-for-of.md
|
|
2106
|
-
'@typescript-eslint/prefer-for-of': 'error',
|
|
2107
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-function-type.md
|
|
2108
|
-
'@typescript-eslint/prefer-function-type': 'error',
|
|
2109
|
-
// https://github.com/typescript-eslint/typescript-eslint/pull/294
|
|
2110
|
-
'@typescript-eslint/prefer-includes': 'error',
|
|
2111
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md
|
|
2112
|
-
'@typescript-eslint/prefer-namespace-keyword': 'off',
|
|
2113
|
-
// https://github.com/typescript-eslint/typescript-eslint/pull/289
|
|
2114
|
-
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
2115
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.md
|
|
2116
|
-
'@typescript-eslint/prefer-literal-enum-member': 'error',
|
|
2117
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-optional-chain.md
|
|
2118
|
-
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
2119
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md
|
|
2120
|
-
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
2121
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md
|
|
2122
|
-
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
|
|
2123
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md
|
|
2124
|
-
'@typescript-eslint/prefer-reduce-type-parameter': 'off',
|
|
2125
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md
|
|
2126
|
-
'@typescript-eslint/prefer-ts-expect-error': 'error',
|
|
2127
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/promise-function-async.md
|
|
2128
|
-
// @BUG
|
|
2129
|
-
'@typescript-eslint/promise-function-async': 'off',
|
|
2130
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-array-sort-compare.md
|
|
2131
|
-
'@typescript-eslint/require-array-sort-compare': 'off',
|
|
2132
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/restrict-plus-operands.md
|
|
2133
|
-
'@typescript-eslint/restrict-plus-operands': 'off',
|
|
2134
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/restrict-template-expressions.md
|
|
2135
|
-
'@typescript-eslint/restrict-template-expressions': [
|
|
2136
|
-
'error',
|
|
2137
|
-
{ allowNumber: true, allowAny: true },
|
|
2138
|
-
],
|
|
2139
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/switch-exhaustiveness-check.md
|
|
2140
|
-
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
2141
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/triple-slash-reference.md
|
|
2142
|
-
'@typescript-eslint/triple-slash-reference': 'off',
|
|
2143
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/type-annotation-spacing.md
|
|
2144
|
-
'@typescript-eslint/type-annotation-spacing': [
|
|
2145
|
-
'error',
|
|
2146
|
-
{
|
|
2147
|
-
before: false,
|
|
2148
|
-
after: true,
|
|
2149
|
-
},
|
|
2150
|
-
],
|
|
2151
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unbound-method.md
|
|
2152
|
-
'@typescript-eslint/unbound-method': 'off',
|
|
2153
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unified-signatures.md
|
|
2154
|
-
'@typescript-eslint/unified-signatures': 'error',
|
|
2155
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/func-call-spacing.md
|
|
2156
|
-
'@typescript-eslint/func-call-spacing': 'off',
|
|
2157
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md
|
|
2158
|
-
'@typescript-eslint/no-magic-numbers': 'off',
|
|
2159
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md
|
|
2160
|
-
'@typescript-eslint/semi': ['error', 'always'],
|
|
2161
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md
|
|
2162
|
-
'@typescript-eslint/prefer-regexp-exec': 'error',
|
|
2163
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
|
|
2164
|
-
'@typescript-eslint/no-empty-function': ['error', { allow: [] }],
|
|
2165
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-floating-promises.md
|
|
2166
|
-
'@typescript-eslint/no-floating-promises': 'off',
|
|
2167
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md
|
|
2168
|
-
'@typescript-eslint/strict-boolean-expressions': 'off',
|
|
2169
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-readonly.md
|
|
2170
|
-
'@typescript-eslint/prefer-readonly': 'error',
|
|
2171
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-misused-promises.md
|
|
2172
|
-
'@typescript-eslint/no-misused-promises': [
|
|
2173
|
-
'error',
|
|
2174
|
-
{ checksVoidReturn: false },
|
|
2175
|
-
],
|
|
2176
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md
|
|
2177
|
-
'@typescript-eslint/require-await': 'off',
|
|
2178
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/55eb0cfac20ccbc2e954083dd554dbcfcbed64fb/packages/eslint-plugin/docs/rules/return-await.md
|
|
2179
|
-
'no-return-await': 'off',
|
|
2180
|
-
'@typescript-eslint/return-await': 'error',
|
|
2181
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md
|
|
2182
|
-
'@typescript-eslint/typedef': [
|
|
2183
|
-
'error',
|
|
2184
|
-
{
|
|
2185
|
-
arrayDestructuring: false,
|
|
2186
|
-
arrowParameter: false,
|
|
2187
|
-
memberVariableDeclaration: true,
|
|
2188
|
-
objectDestructuring: false,
|
|
2189
|
-
parameter: false,
|
|
2190
|
-
propertyDeclaration: true,
|
|
2191
|
-
variableDeclaration: false,
|
|
2192
|
-
variableDeclarationIgnoreFunction: true,
|
|
2193
|
-
},
|
|
2194
|
-
],
|
|
2195
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin//docs/rules/no-unnecessary-type-arguments.md
|
|
2196
|
-
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
|
2197
|
-
'brace-style': 'off',
|
|
2198
|
-
'@typescript-eslint/brace-style': [
|
|
2199
|
-
'error',
|
|
2200
|
-
'1tbs',
|
|
2201
|
-
{ allowSingleLine: true },
|
|
2202
|
-
],
|
|
2203
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-dangle.md
|
|
2204
|
-
'comma-dangle': 'off',
|
|
2205
|
-
'@typescript-eslint/comma-dangle': 'off',
|
|
2206
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-spacing.md
|
|
2207
|
-
'comma-spacing': 'off',
|
|
2208
|
-
'@typescript-eslint/comma-spacing': [
|
|
2209
|
-
'error',
|
|
2210
|
-
{
|
|
2211
|
-
before: false,
|
|
2212
|
-
after: true,
|
|
2213
|
-
},
|
|
2214
|
-
],
|
|
2215
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
|
|
2216
|
-
'dot-notation': 'off',
|
|
2217
|
-
'@typescript-eslint/dot-notation': ['error', { allowKeywords: true }],
|
|
2218
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
|
|
2219
|
-
'keyword-spacing': 'off',
|
|
2220
|
-
'@typescript-eslint/keyword-spacing': [
|
|
2221
|
-
'error',
|
|
2222
|
-
{
|
|
2223
|
-
before: true,
|
|
2224
|
-
after: true,
|
|
2225
|
-
},
|
|
2226
|
-
],
|
|
2227
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/lines-between-class-members.md
|
|
2228
|
-
'lines-between-class-members': 'off',
|
|
2229
|
-
'@typescript-eslint/lines-between-class-members': ['error', 'always'],
|
|
2230
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-dupe-class-members.md
|
|
2231
|
-
'no-dupe-class-members': 'off',
|
|
2232
|
-
'@typescript-eslint/no-dupe-class-members': 'error',
|
|
2233
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-parens.md
|
|
2234
|
-
'no-extra-parens': 'off',
|
|
2235
|
-
'@typescript-eslint/no-extra-parens': [
|
|
2236
|
-
'error',
|
|
2237
|
-
'all',
|
|
2238
|
-
{ ignoreJSX: 'multi-line' },
|
|
2239
|
-
],
|
|
2240
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-semi.md
|
|
2241
|
-
'no-extra-semi': 'off',
|
|
2242
|
-
'@typescript-eslint/no-extra-semi': 'error',
|
|
2243
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implied-eval.md
|
|
2244
|
-
'no-implied-eval': 'off',
|
|
2245
|
-
'@typescript-eslint/no-implied-eval': 'error',
|
|
2246
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md
|
|
2247
|
-
'no-loop-func': 'off',
|
|
2248
|
-
'@typescript-eslint/no-loop-func': 'error',
|
|
2249
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
|
|
2250
|
-
'no-redeclare': 'off',
|
|
2251
|
-
'@typescript-eslint/no-redeclare': ['error', { builtinGlobals: true }],
|
|
2252
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
|
|
2253
|
-
'no-shadow': 'off',
|
|
2254
|
-
'@typescript-eslint/no-shadow': [
|
|
2255
|
-
'error',
|
|
2256
|
-
{
|
|
2257
|
-
builtinGlobals: false,
|
|
2258
|
-
allow: [],
|
|
2259
|
-
},
|
|
2260
|
-
],
|
|
2261
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md
|
|
2262
|
-
'no-throw-literal': 'off',
|
|
2263
|
-
'@typescript-eslint/no-throw-literal': 'error',
|
|
2264
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-function-paren.md
|
|
2265
|
-
'space-before-function-paren': 'off',
|
|
2266
|
-
'@typescript-eslint/space-before-function-paren': [
|
|
2267
|
-
'error',
|
|
2268
|
-
{
|
|
2269
|
-
anonymous: 'always',
|
|
2270
|
-
named: 'never',
|
|
2271
|
-
asyncArrow: 'always',
|
|
2272
|
-
},
|
|
2273
|
-
],
|
|
2274
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-infix-ops.md
|
|
2275
|
-
'space-infix-ops': 'off',
|
|
2276
|
-
'@typescript-eslint/space-infix-ops': 'error',
|
|
2277
|
-
},
|
|
2278
|
-
},
|
|
2279
1813
|
{
|
|
2280
1814
|
files: ['*.test.*', '*.spec.*', '**/__test__/**'],
|
|
2281
1815
|
env: {
|
|
@@ -2306,6 +1840,13 @@ module.exports = {
|
|
|
2306
1840
|
files: ['**/*.md'],
|
|
2307
1841
|
processor: 'markdown/markdown',
|
|
2308
1842
|
},
|
|
1843
|
+
// ignore auto-generated css module declarations
|
|
1844
|
+
{
|
|
1845
|
+
files: ['*.css.d.ts'],
|
|
1846
|
+
rules: {
|
|
1847
|
+
'prettier/prettier': 'off',
|
|
1848
|
+
},
|
|
1849
|
+
},
|
|
2309
1850
|
],
|
|
2310
1851
|
};
|
|
2311
1852
|
/* eslint-enable max-lines, no-magic-numbers */
|
package/index.js
CHANGED
package/lite.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js-app/eslint-config",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "The meta-framework suite designed from scratch for frontend-focused modern web development.",
|
|
5
5
|
"homepage": "https://modernjs.dev",
|
|
6
6
|
"bugs": "https://github.com/modern-js-dev/modern.js/issues",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@babel/eslint-parser": "^7.15.0",
|
|
17
17
|
"@babel/eslint-plugin": "^7.13.10",
|
|
18
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
19
|
-
"@typescript-eslint/parser": "^
|
|
18
|
+
"@typescript-eslint/eslint-plugin": "^5.12.1",
|
|
19
|
+
"@typescript-eslint/parser": "^5.12.1",
|
|
20
20
|
"eslint": "^7.32.0",
|
|
21
21
|
"eslint-config-prettier": "^8.3.0",
|
|
22
22
|
"eslint-import-resolver-webpack": "^0.13.1",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"eslint-plugin-import": "^2.18.2",
|
|
26
26
|
"eslint-plugin-markdown": "^2.2.0",
|
|
27
27
|
"eslint-plugin-node": "^11.1.0",
|
|
28
|
-
"eslint-plugin-prettier": "^
|
|
28
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
29
29
|
"eslint-plugin-promise": "^5.1.0",
|
|
30
30
|
"eslint-plugin-react": "^7.24.0",
|
|
31
31
|
"eslint-plugin-react-hooks": "^4.2.0",
|
package/prettier.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// https://eslint.org/docs/user-guide/configuring#extending-configuration-files
|
|
3
|
+
extends: [
|
|
4
|
+
// https://github.com/prettier/eslint-plugin-prettier
|
|
5
|
+
'plugin:prettier/recommended',
|
|
6
|
+
],
|
|
7
|
+
rules: {
|
|
8
|
+
/**
|
|
9
|
+
* Enable some rules disabled by eslint-config-prettier
|
|
10
|
+
* @Warning : rules bellow can conflict with Prettier in some situations
|
|
11
|
+
*/
|
|
12
|
+
// https://github.com/prettier/eslint-config-prettier#curly
|
|
13
|
+
curly: 'error',
|
|
14
|
+
// https://github.com/prettier/eslint-config-prettier#no-tabs
|
|
15
|
+
'no-tabs': 'error',
|
|
16
|
+
},
|
|
17
|
+
overrides: [
|
|
18
|
+
// ignore auto-generated css module declarations
|
|
19
|
+
{
|
|
20
|
+
files: ['*.css.d.ts'],
|
|
21
|
+
rules: {
|
|
22
|
+
'prettier/prettier': 'off',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
};
|
package/ts.js
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
const { jsExtensions } = require('./utils');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
overrides: [
|
|
5
|
+
{
|
|
6
|
+
files: ['*.ts', '*.d.ts', '*.tsx'],
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* https://eslint.org/blog/2019/01/future-typescript-eslint
|
|
10
|
+
* https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser
|
|
11
|
+
*/
|
|
12
|
+
parser: '@typescript-eslint/parser',
|
|
13
|
+
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin
|
|
14
|
+
plugins: [
|
|
15
|
+
'@typescript-eslint',
|
|
16
|
+
// 'tsdoc'
|
|
17
|
+
],
|
|
18
|
+
// @BUG
|
|
19
|
+
extends: ['plugin:@typescript-eslint/recommended'],
|
|
20
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/config/typescript.js
|
|
21
|
+
settings: {
|
|
22
|
+
'import/external-module-folders': [
|
|
23
|
+
'node_modules',
|
|
24
|
+
'node_modules/@types',
|
|
25
|
+
],
|
|
26
|
+
'import/parsers': {
|
|
27
|
+
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
|
|
28
|
+
},
|
|
29
|
+
'import/resolver': { node: { extensions: jsExtensions } },
|
|
30
|
+
},
|
|
31
|
+
rules: {
|
|
32
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/config/typescript.js
|
|
33
|
+
'import/named': 'off',
|
|
34
|
+
camelcase: 'off',
|
|
35
|
+
indent: 'off',
|
|
36
|
+
'no-unused-vars': 'off',
|
|
37
|
+
'no-use-before-define': 'off',
|
|
38
|
+
// type A = { foo: string; }; export { A };
|
|
39
|
+
'no-undef': 'off',
|
|
40
|
+
'prefer-named-capture-group': 'off',
|
|
41
|
+
'no-useless-constructor': 'off',
|
|
42
|
+
'no-array-constructor': 'off',
|
|
43
|
+
'func-call-spacing': 'off',
|
|
44
|
+
// @BUG no ignore
|
|
45
|
+
'no-magic-numbers': 'off',
|
|
46
|
+
semi: 'off',
|
|
47
|
+
'no-empty-function': 'off',
|
|
48
|
+
'equire-await': 'off',
|
|
49
|
+
'require-await': 'off',
|
|
50
|
+
'one-var': ['error', 'never'],
|
|
51
|
+
// 'jsdoc/no-types': 'error',
|
|
52
|
+
'react/require-default-props': 'off',
|
|
53
|
+
// 'jsdoc/check-tag-names': 'off',
|
|
54
|
+
// https://github.com/microsoft/tsdoc/tree/master/eslint-plugin
|
|
55
|
+
// 'tsdoc/syntax': 'warn',
|
|
56
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md
|
|
57
|
+
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
58
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md
|
|
59
|
+
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
60
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/array-type.md
|
|
61
|
+
'@typescript-eslint/array-type': 'off',
|
|
62
|
+
|
|
63
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-comment.md
|
|
64
|
+
'@typescript-eslint/ban-ts-comment': [
|
|
65
|
+
'error',
|
|
66
|
+
{
|
|
67
|
+
'ts-expect-error': true,
|
|
68
|
+
'ts-ignore': true,
|
|
69
|
+
'ts-nocheck': true,
|
|
70
|
+
'ts-check': false,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md
|
|
74
|
+
'@typescript-eslint/ban-types': 'error',
|
|
75
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-comment.md
|
|
76
|
+
'@typescript-eslint/ban-tslint-comment': 'error',
|
|
77
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/class-literal-property-style.md
|
|
78
|
+
'@typescript-eslint/class-literal-property-style': ['error', 'fields'],
|
|
79
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md
|
|
80
|
+
'@typescript-eslint/consistent-indexed-object-style': 'off',
|
|
81
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-assertions.md
|
|
82
|
+
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
83
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-definitions.md
|
|
84
|
+
'@typescript-eslint/consistent-type-definitions': 'off',
|
|
85
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-imports.md
|
|
86
|
+
'@typescript-eslint/consistent-type-imports': 'off',
|
|
87
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
|
|
88
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
89
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
|
|
90
|
+
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
91
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md
|
|
92
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
93
|
+
'@typescript-eslint/indent': [
|
|
94
|
+
'error',
|
|
95
|
+
2,
|
|
96
|
+
{
|
|
97
|
+
SwitchCase: 1,
|
|
98
|
+
VariableDeclarator: 'first',
|
|
99
|
+
outerIIFEBody: 0,
|
|
100
|
+
MemberExpression: 1,
|
|
101
|
+
FunctionDeclaration: { parameters: 'first' },
|
|
102
|
+
FunctionExpression: { parameters: 'first' },
|
|
103
|
+
CallExpression: { arguments: 'first' },
|
|
104
|
+
ArrayExpression: 1,
|
|
105
|
+
ObjectExpression: 1,
|
|
106
|
+
ImportDeclaration: 1,
|
|
107
|
+
flatTernaryExpressions: false,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-delimiter-style.md
|
|
111
|
+
'@typescript-eslint/member-delimiter-style': [
|
|
112
|
+
'error',
|
|
113
|
+
{
|
|
114
|
+
multiline: {
|
|
115
|
+
delimiter: 'semi',
|
|
116
|
+
requireLast: true,
|
|
117
|
+
},
|
|
118
|
+
singleline: {
|
|
119
|
+
delimiter: 'semi',
|
|
120
|
+
requireLast: true,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.md
|
|
125
|
+
'@typescript-eslint/member-ordering': [
|
|
126
|
+
'error',
|
|
127
|
+
{
|
|
128
|
+
default: [
|
|
129
|
+
'public-static-field',
|
|
130
|
+
'protected-static-field',
|
|
131
|
+
'private-static-field',
|
|
132
|
+
'static-field',
|
|
133
|
+
'public-static-method',
|
|
134
|
+
'protected-static-method',
|
|
135
|
+
'private-static-method',
|
|
136
|
+
'static-method',
|
|
137
|
+
'public-instance-field',
|
|
138
|
+
'protected-instance-field',
|
|
139
|
+
'private-instance-field',
|
|
140
|
+
'instance-field',
|
|
141
|
+
'public-field',
|
|
142
|
+
'protected-field',
|
|
143
|
+
'private-field',
|
|
144
|
+
'field',
|
|
145
|
+
'constructor',
|
|
146
|
+
// 'public-instance-method',
|
|
147
|
+
// 'protected-instance-method',
|
|
148
|
+
// 'private-instance-method',
|
|
149
|
+
'instance-method',
|
|
150
|
+
// 'public-method',
|
|
151
|
+
// 'protected-method',
|
|
152
|
+
// 'private-method',
|
|
153
|
+
'method',
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/method-signature-style.md
|
|
158
|
+
'@typescript-eslint/method-signature-style': 'error',
|
|
159
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
|
|
160
|
+
'@typescript-eslint/naming-convention': [
|
|
161
|
+
'error',
|
|
162
|
+
{
|
|
163
|
+
selector: 'default',
|
|
164
|
+
format: ['camelCase', 'PascalCase', 'UPPER_CASE', 'snake_case'],
|
|
165
|
+
leadingUnderscore: 'allowSingleOrDouble',
|
|
166
|
+
trailingUnderscore: 'allowSingleOrDouble',
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
{
|
|
170
|
+
selector: 'variable',
|
|
171
|
+
format: ['camelCase', 'PascalCase', 'UPPER_CASE', 'snake_case'],
|
|
172
|
+
leadingUnderscore: 'allowSingleOrDouble',
|
|
173
|
+
trailingUnderscore: 'allowSingleOrDouble',
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
{
|
|
177
|
+
selector: 'typeLike',
|
|
178
|
+
format: ['PascalCase'],
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md
|
|
182
|
+
'@typescript-eslint/no-array-constructor': 'error',
|
|
183
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-interface.md
|
|
184
|
+
'@typescript-eslint/no-empty-interface': 'error',
|
|
185
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md
|
|
186
|
+
// @TODO disable?
|
|
187
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
188
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extraneous-class.md
|
|
189
|
+
'@typescript-eslint/no-extraneous-class': 'error',
|
|
190
|
+
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
|
|
191
|
+
'@typescript-eslint/no-implicit-any-catch': 'off',
|
|
192
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-inferrable-types.md
|
|
193
|
+
'@typescript-eslint/no-inferrable-types': [
|
|
194
|
+
'error',
|
|
195
|
+
{ ignoreProperties: true },
|
|
196
|
+
],
|
|
197
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-misused-new.md
|
|
198
|
+
'@typescript-eslint/no-misused-new': 'error',
|
|
199
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-namespace.md
|
|
200
|
+
'@typescript-eslint/no-namespace': 'error',
|
|
201
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md
|
|
202
|
+
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
|
|
203
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-confusing-void-expression.md
|
|
204
|
+
'@typescript-eslint/no-confusing-void-expression': 'off',
|
|
205
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-assertion.md
|
|
206
|
+
// @feedback 在 middleware 下,如果有些参数是 optional 的,会在上一层被拦截掉,下一层一定会有这个参数
|
|
207
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
208
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md
|
|
209
|
+
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
|
210
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-parameter-properties.md
|
|
211
|
+
'@typescript-eslint/no-parameter-properties': 'error',
|
|
212
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-require-imports.md
|
|
213
|
+
'@typescript-eslint/no-require-imports': 'error',
|
|
214
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-this-alias.md
|
|
215
|
+
'@typescript-eslint/no-this-alias': [
|
|
216
|
+
'error',
|
|
217
|
+
{ allowDestructuring: true },
|
|
218
|
+
],
|
|
219
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-type-alias.md
|
|
220
|
+
'@typescript-eslint/no-type-alias': 'off',
|
|
221
|
+
|
|
222
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md
|
|
223
|
+
'@typescript-eslint/no-unnecessary-condition': 'off',
|
|
224
|
+
|
|
225
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md
|
|
226
|
+
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
|
227
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
|
|
228
|
+
'@typescript-eslint/no-unused-vars': [
|
|
229
|
+
'error',
|
|
230
|
+
{
|
|
231
|
+
vars: 'all',
|
|
232
|
+
args: 'after-used',
|
|
233
|
+
ignoreRestSiblings: true,
|
|
234
|
+
argsIgnorePattern: '^_',
|
|
235
|
+
caughtErrors: 'none',
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
'@babel/no-unused-expressions': 'off',
|
|
239
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
|
|
240
|
+
'@typescript-eslint/no-unused-expressions': [
|
|
241
|
+
'error',
|
|
242
|
+
{
|
|
243
|
+
allowShortCircuit: true,
|
|
244
|
+
allowTernary: false,
|
|
245
|
+
allowTaggedTemplates: true,
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
|
|
249
|
+
'@typescript-eslint/no-use-before-define': [
|
|
250
|
+
'error',
|
|
251
|
+
{
|
|
252
|
+
functions: false,
|
|
253
|
+
classes: false,
|
|
254
|
+
variables: false,
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
|
|
258
|
+
'@typescript-eslint/no-useless-constructor': 'error',
|
|
259
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-var-requires.md
|
|
260
|
+
'@typescript-eslint/no-var-requires': 'error',
|
|
261
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-as-const.md
|
|
262
|
+
'@typescript-eslint/prefer-as-const': 'error',
|
|
263
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md
|
|
264
|
+
'@typescript-eslint/prefer-enum-initializers': 'off',
|
|
265
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-for-of.md
|
|
266
|
+
'@typescript-eslint/prefer-for-of': 'error',
|
|
267
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-function-type.md
|
|
268
|
+
'@typescript-eslint/prefer-function-type': 'error',
|
|
269
|
+
|
|
270
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md
|
|
271
|
+
'@typescript-eslint/prefer-namespace-keyword': 'off',
|
|
272
|
+
|
|
273
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.md
|
|
274
|
+
'@typescript-eslint/prefer-literal-enum-member': 'error',
|
|
275
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-optional-chain.md
|
|
276
|
+
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
277
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md
|
|
278
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
279
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md
|
|
280
|
+
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
|
|
281
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md
|
|
282
|
+
'@typescript-eslint/prefer-reduce-type-parameter': 'off',
|
|
283
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md
|
|
284
|
+
'@typescript-eslint/prefer-ts-expect-error': 'error',
|
|
285
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/promise-function-async.md
|
|
286
|
+
// @BUG
|
|
287
|
+
'@typescript-eslint/promise-function-async': 'off',
|
|
288
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-array-sort-compare.md
|
|
289
|
+
'@typescript-eslint/require-array-sort-compare': 'off',
|
|
290
|
+
|
|
291
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/triple-slash-reference.md
|
|
292
|
+
'@typescript-eslint/triple-slash-reference': 'off',
|
|
293
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/type-annotation-spacing.md
|
|
294
|
+
'@typescript-eslint/type-annotation-spacing': [
|
|
295
|
+
'error',
|
|
296
|
+
{
|
|
297
|
+
before: false,
|
|
298
|
+
after: true,
|
|
299
|
+
},
|
|
300
|
+
],
|
|
301
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unified-signatures.md
|
|
302
|
+
'@typescript-eslint/unified-signatures': 'error',
|
|
303
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/func-call-spacing.md
|
|
304
|
+
'@typescript-eslint/func-call-spacing': 'off',
|
|
305
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md
|
|
306
|
+
'@typescript-eslint/no-magic-numbers': 'off',
|
|
307
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md
|
|
308
|
+
'@typescript-eslint/semi': ['error', 'always'],
|
|
309
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
|
|
310
|
+
'@typescript-eslint/no-empty-function': ['error', { allow: [] }],
|
|
311
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md
|
|
312
|
+
'@typescript-eslint/strict-boolean-expressions': 'off',
|
|
313
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md
|
|
314
|
+
'@typescript-eslint/typedef': [
|
|
315
|
+
'error',
|
|
316
|
+
{
|
|
317
|
+
arrayDestructuring: false,
|
|
318
|
+
arrowParameter: false,
|
|
319
|
+
memberVariableDeclaration: true,
|
|
320
|
+
objectDestructuring: false,
|
|
321
|
+
parameter: false,
|
|
322
|
+
propertyDeclaration: true,
|
|
323
|
+
variableDeclaration: false,
|
|
324
|
+
variableDeclarationIgnoreFunction: true,
|
|
325
|
+
},
|
|
326
|
+
],
|
|
327
|
+
|
|
328
|
+
'brace-style': 'off',
|
|
329
|
+
'@typescript-eslint/brace-style': [
|
|
330
|
+
'error',
|
|
331
|
+
'1tbs',
|
|
332
|
+
{ allowSingleLine: true },
|
|
333
|
+
],
|
|
334
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-dangle.md
|
|
335
|
+
'comma-dangle': 'off',
|
|
336
|
+
'@typescript-eslint/comma-dangle': 'off',
|
|
337
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-spacing.md
|
|
338
|
+
'comma-spacing': 'off',
|
|
339
|
+
'@typescript-eslint/comma-spacing': [
|
|
340
|
+
'error',
|
|
341
|
+
{
|
|
342
|
+
before: false,
|
|
343
|
+
after: true,
|
|
344
|
+
},
|
|
345
|
+
],
|
|
346
|
+
|
|
347
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
|
|
348
|
+
'keyword-spacing': 'off',
|
|
349
|
+
'@typescript-eslint/keyword-spacing': [
|
|
350
|
+
'error',
|
|
351
|
+
{
|
|
352
|
+
before: true,
|
|
353
|
+
after: true,
|
|
354
|
+
},
|
|
355
|
+
],
|
|
356
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/lines-between-class-members.md
|
|
357
|
+
'lines-between-class-members': 'off',
|
|
358
|
+
'@typescript-eslint/lines-between-class-members': ['error', 'always'],
|
|
359
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-dupe-class-members.md
|
|
360
|
+
'no-dupe-class-members': 'off',
|
|
361
|
+
'@typescript-eslint/no-dupe-class-members': 'error',
|
|
362
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-parens.md
|
|
363
|
+
'no-extra-parens': 'off',
|
|
364
|
+
'@typescript-eslint/no-extra-parens': [
|
|
365
|
+
'error',
|
|
366
|
+
'all',
|
|
367
|
+
{ ignoreJSX: 'multi-line' },
|
|
368
|
+
],
|
|
369
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-semi.md
|
|
370
|
+
'no-extra-semi': 'off',
|
|
371
|
+
'@typescript-eslint/no-extra-semi': 'error',
|
|
372
|
+
|
|
373
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md
|
|
374
|
+
'no-loop-func': 'off',
|
|
375
|
+
'@typescript-eslint/no-loop-func': 'error',
|
|
376
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
|
|
377
|
+
'no-redeclare': 'off',
|
|
378
|
+
'@typescript-eslint/no-redeclare': ['error', { builtinGlobals: true }],
|
|
379
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
|
|
380
|
+
'no-shadow': 'off',
|
|
381
|
+
'@typescript-eslint/no-shadow': [
|
|
382
|
+
'error',
|
|
383
|
+
{
|
|
384
|
+
builtinGlobals: false,
|
|
385
|
+
allow: [],
|
|
386
|
+
},
|
|
387
|
+
],
|
|
388
|
+
|
|
389
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-function-paren.md
|
|
390
|
+
'space-before-function-paren': 'off',
|
|
391
|
+
'@typescript-eslint/space-before-function-paren': [
|
|
392
|
+
'error',
|
|
393
|
+
{
|
|
394
|
+
anonymous: 'always',
|
|
395
|
+
named: 'never',
|
|
396
|
+
asyncArrow: 'always',
|
|
397
|
+
},
|
|
398
|
+
],
|
|
399
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-infix-ops.md
|
|
400
|
+
'space-infix-ops': 'off',
|
|
401
|
+
'@typescript-eslint/space-infix-ops': 'error',
|
|
402
|
+
},
|
|
403
|
+
},
|
|
404
|
+
],
|
|
405
|
+
};
|
package/ts.withType.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
overrides: [
|
|
3
|
+
{
|
|
4
|
+
files: ['*.ts', '*.d.ts', '*.tsx'],
|
|
5
|
+
extends: ['./ts'],
|
|
6
|
+
parserOptions: {
|
|
7
|
+
ecmaFeatures: { jsx: true },
|
|
8
|
+
// don't set tsconfigRootDir, using the path relative to the cwd
|
|
9
|
+
project: ['./tsconfig.json'],
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/await-thenable.md
|
|
13
|
+
'@typescript-eslint/await-thenable': 'error',
|
|
14
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-for-in-array.md
|
|
15
|
+
'@typescript-eslint/no-for-in-array': 'error',
|
|
16
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implied-eval.md
|
|
17
|
+
'no-implied-eval': 'off',
|
|
18
|
+
'@typescript-eslint/no-implied-eval': 'error',
|
|
19
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-misused-promises.md
|
|
20
|
+
'@typescript-eslint/no-misused-promises': [
|
|
21
|
+
'error',
|
|
22
|
+
{ checksVoidReturn: false },
|
|
23
|
+
],
|
|
24
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md
|
|
25
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
26
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/restrict-template-expressions.md
|
|
27
|
+
'@typescript-eslint/restrict-template-expressions': [
|
|
28
|
+
'error',
|
|
29
|
+
{ allowNumber: true, allowAny: true },
|
|
30
|
+
],
|
|
31
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-base-to-string.md
|
|
32
|
+
'@typescript-eslint/no-base-to-string': 'error',
|
|
33
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md
|
|
34
|
+
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
|
35
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-qualifier.md
|
|
36
|
+
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
37
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin//docs/rules/no-unnecessary-type-arguments.md
|
|
38
|
+
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
|
39
|
+
// https://github.com/typescript-eslint/typescript-eslint/pull/294
|
|
40
|
+
'@typescript-eslint/prefer-includes': 'error',
|
|
41
|
+
// https://github.com/typescript-eslint/typescript-eslint/pull/289
|
|
42
|
+
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
43
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md
|
|
44
|
+
'@typescript-eslint/prefer-regexp-exec': 'error',
|
|
45
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-readonly.md
|
|
46
|
+
'@typescript-eslint/prefer-readonly': 'error',
|
|
47
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/switch-exhaustiveness-check.md
|
|
48
|
+
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
49
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/55eb0cfac20ccbc2e954083dd554dbcfcbed64fb/packages/eslint-plugin/docs/rules/return-await.md
|
|
50
|
+
'no-return-await': 'off',
|
|
51
|
+
'@typescript-eslint/return-await': 'error',
|
|
52
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
|
|
53
|
+
'dot-notation': 'off',
|
|
54
|
+
'@typescript-eslint/dot-notation': ['error', { allowKeywords: true }],
|
|
55
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md
|
|
56
|
+
'no-throw-literal': 'off',
|
|
57
|
+
'@typescript-eslint/no-throw-literal': 'error',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
package/eslintrc.prettier.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
// https://eslint.org/docs/user-guide/configuring#extending-configuration-files
|
|
3
|
-
extends: [
|
|
4
|
-
'./eslintrc.js',
|
|
5
|
-
// https://www.npmjs.com/package/eslint-config-prettier
|
|
6
|
-
// https://github.com/prettier/eslint-config-prettier/blob/master/index.js#L14
|
|
7
|
-
'prettier',
|
|
8
|
-
],
|
|
9
|
-
env: {
|
|
10
|
-
commonjs: false,
|
|
11
|
-
browser: true,
|
|
12
|
-
node: false,
|
|
13
|
-
},
|
|
14
|
-
rules: {
|
|
15
|
-
// https://github.com/prettier/eslint-config-prettier#curly
|
|
16
|
-
curly: 'error',
|
|
17
|
-
// https://github.com/prettier/eslint-config-prettier#max-len
|
|
18
|
-
'max-len': [
|
|
19
|
-
'error',
|
|
20
|
-
{
|
|
21
|
-
code: 80,
|
|
22
|
-
tabWidth: 4,
|
|
23
|
-
ignoreComments: true,
|
|
24
|
-
ignoreTrailingComments: false,
|
|
25
|
-
ignoreUrls: true,
|
|
26
|
-
ignoreStrings: true,
|
|
27
|
-
ignoreTemplateLiterals: true,
|
|
28
|
-
ignoreRegExpLiterals: true,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
// https://github.com/prettier/eslint-config-prettier#no-confusing-arrow
|
|
32
|
-
'no-confusing-arrow': 'off',
|
|
33
|
-
// https://github.com/prettier/eslint-config-prettier#no-mixed-operators
|
|
34
|
-
'no-mixed-operators': 'off',
|
|
35
|
-
// https://github.com/prettier/eslint-config-prettier#no-tabs
|
|
36
|
-
'no-tabs': 'error',
|
|
37
|
-
// https://github.com/prettier/eslint-config-prettier#quotes
|
|
38
|
-
quotes: 'off',
|
|
39
|
-
},
|
|
40
|
-
// https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns
|
|
41
|
-
// https://eslint.org/docs/user-guide/migrating-to-6.0.0#-overrides-in-an-extended-config-file-can-now-be-overridden-by-a-parent-config-file
|
|
42
|
-
overrides: [
|
|
43
|
-
{
|
|
44
|
-
files: ['*.ts', '*.tsx'],
|
|
45
|
-
rules: {
|
|
46
|
-
'@typescript-eslint/indent': 'off',
|
|
47
|
-
'@typescript-eslint/member-delimiter-style': 'off',
|
|
48
|
-
'@typescript-eslint/type-annotation-spacing': 'off',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
files: ['*.test.*', '__test__/*'],
|
|
53
|
-
env: {
|
|
54
|
-
mocha: true,
|
|
55
|
-
jest: true,
|
|
56
|
-
},
|
|
57
|
-
rules: {
|
|
58
|
-
'no-unused-expressions': 'off',
|
|
59
|
-
'@babel/no-unused-expressions': 'off',
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
files: ['*.worker.*'],
|
|
64
|
-
env: { worker: true },
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
files: ['**/pages/**/_*', '**/pages/**/\\[**'],
|
|
68
|
-
rules: {
|
|
69
|
-
'filenames/match-regex': 'off',
|
|
70
|
-
'filenames/match-exported': 'off',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
// ignore auto-generated css module declarations
|
|
74
|
-
{
|
|
75
|
-
files: ['*.css.d.ts'],
|
|
76
|
-
rules: {
|
|
77
|
-
'pre/match-regex': 'off',
|
|
78
|
-
'filenames/match-exported': 'off',
|
|
79
|
-
'prettier/prettier': 'off',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
};
|