| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Logic to validate that developers are correctly using Polymer constructs. | 6 * Logic to validate that developers are correctly using Polymer constructs. |
| 7 * This is mainly used to produce warnings for feedback in the editor. | 7 * This is mainly used to produce warnings for feedback in the editor. |
| 8 */ | 8 */ |
| 9 library polymer.src.linter; | 9 library polymer.src.linter; |
| 10 | 10 |
| 11 import 'dart:io'; | 11 import 'dart:io'; |
| 12 import 'dart:async'; | 12 import 'dart:async'; |
| 13 import 'dart:mirrors'; | 13 import 'dart:mirrors'; |
| 14 import 'dart:convert' show JSON; | 14 import 'dart:convert' show JSON; |
| 15 | 15 |
| 16 import 'package:barback/barback.dart'; | 16 import 'package:barback/barback.dart'; |
| 17 import 'package:html5lib/dom.dart'; | 17 import 'package:html5lib/dom.dart'; |
| 18 import 'package:html5lib/dom_parsing.dart'; | 18 import 'package:html5lib/dom_parsing.dart'; |
| 19 | 19 |
| 20 import 'transform/common.dart'; | 20 import 'common.dart'; |
| 21 | 21 |
| 22 typedef String MessageFormatter(String kind, String message, Span span); | 22 typedef String MessageFormatter(String kind, String message, Span span); |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * A linter that checks for common Polymer errors and produces warnings to | 25 * A linter that checks for common Polymer errors and produces warnings to |
| 26 * show on the editor or the command line. Leaves sources unchanged, but creates | 26 * show on the editor or the command line. Leaves sources unchanged, but creates |
| 27 * a new asset containing all the warnings. | 27 * a new asset containing all the warnings. |
| 28 */ | 28 */ |
| 29 class Linter extends Transformer with PolymerTransformer { | 29 class Linter extends Transformer with PolymerTransformer { |
| 30 final TransformOptions options; | 30 final TransformOptions options; |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 * <https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn
-custom-element-name> | 435 * <https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn
-custom-element-name> |
| 436 */ | 436 */ |
| 437 bool _isCustomTag(String name) { | 437 bool _isCustomTag(String name) { |
| 438 if (name == null || !name.contains('-')) return false; | 438 if (name == null || !name.contains('-')) return false; |
| 439 return !_invalidTagNames.containsKey(name); | 439 return !_invalidTagNames.containsKey(name); |
| 440 } | 440 } |
| 441 | 441 |
| 442 final String _RED_COLOR = '\u001b[31m'; | 442 final String _RED_COLOR = '\u001b[31m'; |
| 443 final String _MAGENTA_COLOR = '\u001b[35m'; | 443 final String _MAGENTA_COLOR = '\u001b[35m'; |
| 444 final String _NO_COLOR = '\u001b[0m'; | 444 final String _NO_COLOR = '\u001b[0m'; |
| OLD | NEW |