@@ -13,43 +13,43 @@ import nb_eslint from '@nothing-but/eslint-plugin'
1313@returns {string[] } */
1414function gitignore_to_glob_patterns ( gitignore ) {
1515
16- const patterns = [ ]
16+ const patterns = [ ]
1717
18- for ( let pattern of gitignore . split ( '\n' ) ) {
18+ for ( let pattern of gitignore . split ( '\n' ) ) {
1919
20- pattern = pattern . trim ( )
20+ pattern = pattern . trim ( )
2121
22- if ( pattern === '' || pattern . startsWith ( '#' ) ) {
23- continue
24- }
22+ if ( pattern === '' || pattern . startsWith ( '#' ) ) {
23+ continue
24+ }
2525
26- let negated = false
27- if ( pattern [ 0 ] === '!' ) {
28- negated = true
29- pattern = pattern . slice ( 1 )
30- }
26+ let negated = false
27+ if ( pattern [ 0 ] === '!' ) {
28+ negated = true
29+ pattern = pattern . slice ( 1 )
30+ }
3131
32- if ( pattern [ 0 ] === '/' ) {
33- pattern = pattern . slice ( 1 )
34- } else if ( ! pattern . startsWith ( '**/' ) ) {
35- pattern = '**/' + pattern
36- }
32+ if ( pattern [ 0 ] === '/' ) {
33+ pattern = pattern . slice ( 1 )
34+ } else if ( ! pattern . startsWith ( '**/' ) ) {
35+ pattern = '**/' + pattern
36+ }
3737
3838 if ( negated ) {
3939 pattern = '!' + pattern
4040 }
4141
42- if ( pattern . indexOf ( '.' ) > 0 ) {
42+ if ( pattern . indexOf ( '.' ) > 0 ) {
4343 patterns . push ( pattern )
4444 } else {
45- patterns . push ( pattern )
45+ patterns . push ( pattern )
4646 if ( pattern . endsWith ( '/' ) ) {
47- patterns . push ( pattern + '**/*' )
47+ patterns . push ( pattern + '**/*' )
4848 } else {
49- patterns . push ( pattern + '/**/*' )
49+ patterns . push ( pattern + '/**/*' )
5050 }
5151 }
52- }
52+ }
5353
5454 return patterns
5555}
@@ -59,70 +59,70 @@ const git_ignored_paths = gitignore_to_glob_patterns(fs.readFileSync('.gitignore
5959/** @type {import('eslint').Linter.Config[] } */
6060export default [ {
6161
62- files : [ '**/*.{js,mjs,jsx,ts,tsx}' ] ,
63-
64- plugins : {
65- '@typescript-eslint' : /** @type {* } */ ( ts_eslint ) ,
66- '@no-only-tests' : no_only_tests ,
67- '@eslint-comments' : eslint_comments ,
68- '@nothing-but' : /** @type {* } */ ( nb_eslint ) ,
69- } ,
70-
71- languageOptions : {
72- parser : ts_parser ,
73- ecmaVersion : 5 ,
74- sourceType : 'module' ,
75-
76- parserOptions : {
77- project : './tsconfig.json' ,
78- tsconfigRootDir : '.' ,
79- } ,
80- } ,
81-
82- rules : {
83- /*
84- forgot to remove/implement
85- */
86- 'no-console' : 'warn' ,
87- 'no-debugger' : 'warn' ,
88- // 'prefer-const' : 'warn',
89- 'require-await' : 'warn' ,
90- 'no-empty' : 'warn' ,
91- '@typescript-eslint/no-unused-vars' : [ 'warn' , {
92- 'argsIgnorePattern' : '^_' ,
93- 'varsIgnorePattern' : '^_' ,
94- 'caughtErrorsIgnorePattern' : '^_'
95- } ] ,
96- '@typescript-eslint/no-unnecessary-boolean-literal-compare' : 'warn' ,
97- '@typescript-eslint/no-unnecessary-condition' : 'warn' ,
98- '@typescript-eslint/no-unnecessary-qualifier' : 'warn' ,
99- '@typescript-eslint/no-unnecessary-type-arguments' : 'warn' ,
100- '@typescript-eslint/no-unnecessary-type-assertion' : 'warn' ,
101- '@typescript-eslint/no-unnecessary-type-constraint' : 'warn' ,
102- '@typescript-eslint/no-useless-empty-export' : 'warn' ,
103- '@typescript-eslint/no-empty-function' : 'warn' ,
104- '@typescript-eslint/no-unused-expressions' : [ 'warn' , {
105- 'allowShortCircuit' : true ,
106- 'allowTernary' : true ,
107- } ] ,
108- '@eslint-comments/no-unused-disable' : 'warn' ,
62+ files : [ '**/*.{js,mjs,jsx,ts,tsx}' ] ,
63+
64+ plugins : {
65+ '@typescript-eslint' : /** @type {* } */ ( ts_eslint ) ,
66+ '@no-only-tests' : no_only_tests ,
67+ '@eslint-comments' : eslint_comments ,
68+ '@nothing-but' : /** @type {* } */ ( nb_eslint ) ,
69+ } ,
70+
71+ languageOptions : {
72+ parser : ts_parser ,
73+ ecmaVersion : 5 ,
74+ sourceType : 'module' ,
75+
76+ parserOptions : {
77+ project : './tsconfig.json' ,
78+ tsconfigRootDir : '.' ,
79+ } ,
80+ } ,
81+
82+ rules : {
83+ /*
84+ forgot to remove/implement
85+ */
86+ 'no-console' : 'warn' ,
87+ 'no-debugger' : 'warn' ,
88+ // 'prefer-const' : 'warn',
89+ 'require-await' : 'warn' ,
90+ 'no-empty' : 'warn' ,
91+ '@typescript-eslint/no-unused-vars' : [ 'warn' , {
92+ 'argsIgnorePattern' : '^_' ,
93+ 'varsIgnorePattern' : '^_' ,
94+ 'caughtErrorsIgnorePattern' : '^_'
95+ } ] ,
96+ '@typescript-eslint/no-unnecessary-boolean-literal-compare' : 'warn' ,
97+ '@typescript-eslint/no-unnecessary-condition' : 'warn' ,
98+ '@typescript-eslint/no-unnecessary-qualifier' : 'warn' ,
99+ '@typescript-eslint/no-unnecessary-type-arguments' : 'warn' ,
100+ '@typescript-eslint/no-unnecessary-type-assertion' : 'warn' ,
101+ '@typescript-eslint/no-unnecessary-type-constraint' : 'warn' ,
102+ '@typescript-eslint/no-useless-empty-export' : 'warn' ,
103+ '@typescript-eslint/no-empty-function' : 'warn' ,
104+ '@typescript-eslint/no-unused-expressions' : [ 'warn' , {
105+ 'allowShortCircuit' : true ,
106+ 'allowTernary' : true ,
107+ } ] ,
108+ '@eslint-comments/no-unused-disable' : 'warn' ,
109109 /*
110- prevent unexpected behavior
111- */
112- '@typescript-eslint/no-empty-object-type' : 'warn' ,
113- '@typescript-eslint/no-unsafe-function-type' : 'warn' ,
114- '@typescript-eslint/no-wrapper-object-types' : 'warn' ,
115- '@typescript-eslint/switch-exhaustiveness-check' : 'warn' ,
116- 'no-fallthrough' : [ 'warn' , { 'allowEmptyCase' : true } ] ,
117- // '@nothing-but/no-ignored-return': 'warn',
118- // '@nothing-but/no-return-to-void': 'warn',
110+ prevent unexpected behavior
111+ */
112+ '@typescript-eslint/no-empty-object-type' : 'warn' ,
113+ '@typescript-eslint/no-unsafe-function-type' : 'warn' ,
114+ '@typescript-eslint/no-wrapper-object-types' : 'warn' ,
115+ '@typescript-eslint/switch-exhaustiveness-check' : 'warn' ,
116+ 'no-fallthrough' : [ 'warn' , { 'allowEmptyCase' : true } ] ,
117+ // '@nothing-but/no-ignored-return': 'warn',
118+ // '@nothing-but/no-return-to-void': 'warn',
119119 /*
120- tests
121- */
122- '@no-only-tests/no-only-tests' : 'warn' ,
123- } ,
120+ tests
121+ */
122+ '@no-only-tests/no-only-tests' : 'warn' ,
123+ } ,
124124} , {
125125 // ignores need to be in a separate config for some reason
126126 // https://github.com/eslint/eslint/issues/17400
127- ignores : [ 'examples/**/*' , ...git_ignored_paths ] ,
127+ ignores : [ 'examples/**/*' , ...git_ignored_paths ] ,
128128} ]
0 commit comments