11const rules = {
2- 'curly' : [ 'error' ] ,
3- 'eol-last' : [ 'error' ] ,
4- 'keyword-spacing' : [ 'error' ] ,
5- 'linebreak-style' : [ 'error' , 'unix' ] ,
6- 'max-len' : [
7- 'error' ,
8- {
9- 'code' : 100 ,
10- 'tabWidth' : 4 ,
11- 'ignoreStrings' : true ,
12- 'ignoreRegExpLiterals' : true ,
13- 'ignoreUrls' : true ,
14- } ,
15- ] ,
16- 'no-trailing-spaces' : [ 'error' , { 'skipBlankLines' : true } ] ,
172 'no-unused-vars' : [
18- 'warn ' ,
3+ 'error ' ,
194 {
205 'args' : 'after-used' ,
216 // Ignore vars starting with an underscore.
@@ -29,20 +14,12 @@ const rules = {
2914 // Blockly uses single quotes except for JSON blobs, which must use double
3015 // quotes.
3116 'quotes' : [ 'off' ] ,
32- 'semi' : [ 'error' , 'always' ] ,
33- // Blockly doesn't have space before function paren when defining functions.
34- 'space-before-function-paren' : [ 'error' , 'never' ] ,
35- // Blockly doesn't have space before function paren when calling functions.
36- 'func-call-spacing' : [ 'error' , 'never' ] ,
37- 'space-infix-ops' : [ 'error' ] ,
3817 // Blockly uses 'use strict' in files.
3918 'strict' : [ 'off' ] ,
4019 // Closure style allows redeclarations.
4120 'no-redeclare' : [ 'off' ] ,
4221 'valid-jsdoc' : [ 'error' ] ,
4322 'no-console' : [ 'off' ] ,
44- 'no-multi-spaces' : [ 'error' , { 'ignoreEOLComments' : true } ] ,
45- 'operator-linebreak' : [ 'error' , 'after' ] ,
4623 'spaced-comment' : [
4724 'error' ,
4825 'always' ,
@@ -61,27 +38,13 @@ const rules = {
6138 'allow' : [ '^opt_' , '^_opt_' , '^testOnly_' ] ,
6239 } ,
6340 ] ,
64- // Use clang-format for indentation by running `npm run format`.
65- 'indent' : [ 'off' ] ,
6641 // Blockly uses capital letters for some non-constructor namespaces.
6742 // Keep them for legacy reasons.
6843 'new-cap' : [ 'off' ] ,
69- // Mostly use default rules for brace style, but allow single-line blocks.
70- 'brace-style' : [ 'error' , '1tbs' , { 'allowSingleLine' : true } ] ,
7144 // Blockly uses objects as maps, but uses Object.create(null) to
7245 // instantiate them.
7346 'guard-for-in' : [ 'off' ] ,
7447 'prefer-spread' : [ 'off' ] ,
75- 'comma-dangle' : [
76- 'error' ,
77- {
78- 'arrays' : 'always-multiline' ,
79- 'objects' : 'always-multiline' ,
80- 'imports' : 'always-multiline' ,
81- 'exports' : 'always-multiline' ,
82- 'functions' : 'ignore' ,
83- } ,
84- ] ,
8548} ;
8649
8750/**
@@ -92,10 +55,7 @@ const rules = {
9255function buildTSOverride ( { files, tsconfig} ) {
9356 return {
9457 'files' : files ,
95- 'plugins' : [
96- '@typescript-eslint/eslint-plugin' ,
97- 'jsdoc' ,
98- ] ,
58+ 'plugins' : [ '@typescript-eslint/eslint-plugin' , 'jsdoc' ] ,
9959 'settings' : {
10060 'jsdoc' : {
10161 'mode' : 'typescript' ,
@@ -111,6 +71,7 @@ function buildTSOverride({files, tsconfig}) {
11171 'extends' : [
11272 'plugin:@typescript-eslint/recommended' ,
11373 'plugin:jsdoc/recommended' ,
74+ 'prettier' , // Extend again so that these rules are applied last
11475 ] ,
11576 'rules' : {
11677 // TS rules
@@ -124,14 +85,12 @@ function buildTSOverride({files, tsconfig}) {
12485 // Use TS-specific rule.
12586 'no-unused-vars' : [ 'off' ] ,
12687 '@typescript-eslint/no-unused-vars' : [
127- 'warn ' ,
88+ 'error ' ,
12889 {
12990 'argsIgnorePattern' : '^_' ,
13091 'varsIgnorePattern' : '^_' ,
13192 } ,
13293 ] ,
133- 'func-call-spacing' : [ 'off' ] ,
134- '@typescript-eslint/func-call-spacing' : [ 'warn' ] ,
13594 // Temporarily disable. 23 problems.
13695 '@typescript-eslint/no-explicit-any' : [ 'off' ] ,
13796 // Temporarily disable. 128 problems.
@@ -162,9 +121,19 @@ function buildTSOverride({files, tsconfig}) {
162121 'publicOnly' : true ,
163122 } ,
164123 ] ,
165- // Disable because of false alarms with Closure-supported tags.
166- // Re-enable after Closure is removed.
167- 'jsdoc/check-tag-names' : [ 'off' ] ,
124+ 'jsdoc/check-tag-names' : [
125+ 'error' ,
126+ {
127+ 'definedTags' : [
128+ 'sealed' ,
129+ 'typeParam' ,
130+ 'remarks' ,
131+ 'define' ,
132+ 'nocollapse' ,
133+ 'suppress' ,
134+ ] ,
135+ } ,
136+ ] ,
168137 // Re-enable after Closure is removed. There shouldn't even be
169138 // types in the TsDoc.
170139 // These are "types" because of Closure's @suppress {warningName}
@@ -176,7 +145,9 @@ function buildTSOverride({files, tsconfig}) {
176145 'jsdoc/check-param-names' : [ 'off' , { 'checkDestructured' : false } ] ,
177146 // Allow any text in the license tag. Other checks are not relevant.
178147 'jsdoc/check-values' : [ 'off' ] ,
179- 'jsdoc/newline-after-description' : [ 'error' ] ,
148+ // Ensure there is a blank line between the body and any @tags ,
149+ // as required by the tsdoc spec (see #6353).
150+ 'jsdoc/tag-lines' : [ 'error' , 'any' , { 'startLines' : 1 } ] ,
180151 } ,
181152 } ;
182153}
@@ -193,21 +164,15 @@ const eslintJSON = {
193164 'goog' : true ,
194165 'exports' : true ,
195166 } ,
196- 'extends' : [
197- 'eslint:recommended' ,
198- 'google' ,
199- ] ,
167+ 'extends' : [ 'eslint:recommended' , 'google' , 'prettier' ] ,
200168 // TypeScript-specific config. Uses above rules plus these.
201169 'overrides' : [
202170 buildTSOverride ( {
203- files : [ './core/ **/*.ts' , './core /**/*.tsx' ] ,
171+ files : [ './**/*.ts' , './**/*.tsx' ] ,
204172 tsconfig : './tsconfig.json' ,
205173 } ) ,
206174 buildTSOverride ( {
207- files : [
208- './tests/typescript/**/*.ts' ,
209- './tests/typescript/**/*.tsx' ,
210- ] ,
175+ files : [ './tests/typescript/**/*.ts' , './tests/typescript/**/*.tsx' ] ,
211176 tsconfig : './tests/typescript/tsconfig.json' ,
212177 } ) ,
213178 {
0 commit comments