惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
S
Schneier on Security
The Hacker News
The Hacker News
P
Proofpoint News Feed
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
I
Intezer
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Schneier on Security
Schneier on Security
Security Latest
Security Latest
AWS News Blog
AWS News Blog
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
有赞技术团队
有赞技术团队
博客园 - 叶小钗
The Last Watchdog
The Last Watchdog
O
OpenAI News
月光博客
月光博客
Hacker News: Ask HN
Hacker News: Ask HN
阮一峰的网络日志
阮一峰的网络日志
S
Security @ Cisco Blogs
Google Online Security Blog
Google Online Security Blog
云风的 BLOG
云风的 BLOG
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Latest news
Latest news
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
M
MIT News - Artificial intelligence
Google DeepMind News
Google DeepMind News
P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
Apple Machine Learning Research
Apple Machine Learning Research
U
Unit 42
PCI Perspectives
PCI Perspectives
博客园 - 聂微东
SecWiki News
SecWiki News
宝玉的分享
宝玉的分享
Forbes - Security
Forbes - Security
H
Heimdal Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Troy Hunt's Blog
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
罗磊的独立博客
WordPress大学
WordPress大学
D
Darknet – Hacking Tools, Hacker News & Cyber Security

Ember.js Blog

Ember 7.0 Released Announcing the Official TypeScript Types Public Preview Accessibility Working Group Update The 2020 Ember Roadmap Countdown to The New Year - Built-in Addons Countdown to The New Year - Ember Exam Countdown to The New Year - Ember Code Snippet Countdown to The New Year - Ember Changeset Countdown to The New Year - Ember In Viewport Countdown to The New Year - Ember CLI Update Countdown to The New Year - Ember Template Invocation Location Countdown to The New Year - Ember CLI TypeScript Countdown to The New Year - Ember Bootstrap and Ember Paper Countdown to The New Year - Ember CSS Modules Countdown to The New Year - Ember Mapbox GL Countdown to The New Year - Ember Shepherd Countdown to The New Year - Ember Template Lint Countdown to The New Year - Ember Composable Helpers Countdown to The New Year - Ember Leaflet Countdown to The New Year - Ember Intl Countdown to The New Year - Ember Test Selectors Countdown to The New Year - Ember Power Select Countdown to The New Year - Ember Simple Auth Countdown to The New Year - Ember SVG Jar Countdown to The New Year - Ember Page Title Countdown to The New Year- Ember A11Y Testing Countdown to The New Year - Ember Angle Brackets Codemod Countdown to The New Year - Ember CLI Sass Countdown to The New Year - Ember Animated Countdown to The New Year - Ember Auto Import Countdown to The New Year - Ember Concurrency Countdown to The New Year - Ember Tether Countdown to The New Year - Ember Modifier Countdown to The New Year - Ember CLI Mirage Countdown to The New Year - Ember Sortable Coming Soon in Ember Octane - Part 5: Glimmer Components Coming Soon in Ember Octane - Part 4: Modifiers Coming Soon in Ember Octane - Part 3: Tracked Properties Coming Soon in Ember Octane - Part 2: Angle Brackets & Named Arguments Preview Weekend: 2019 Ember Community Survey Coming Soon in Ember Octane - Part 1: Native Classes First Annual DecEmber Event! 2018 Ember Community Survey 2017 Ember Community Survey Announcing The Glimmer 2 Alpha Upcoming deprecation of baseURL in Ember CLI 2.7 2016 Ember Community Survey Announcing Ember Core Team Face to Face, January 2016 Ember.js 1.13.0 and 2.0 Beta Released Another Ember 2.x Status Update Ember.js 1.12 and 1.13 Beta (Glimmer!) Released Ember.js 1.11.1 Released Ember.js 1.11.0 and 1.12 Beta Released Ember.js 1.10.0 and 1.11 Beta Released Compiling templates with Ember 1.10 Core Team Meeting Minutes - 2014/08/01 Core Team Meeting Minutes - 2014/08/14 Core Team Meeting Minutes - 2014/09/12 Cleaning Up Github Issues Core Team Meeting Minutes - 2014/07/11 Core Team Meeting Minutes - 2014/07/25 Core Team Meeting Minutes - 2014/06/13 Core Team Meeting Minutes - 2014/06/20 Core Team Meeting Minutes - 2014/06/27 Core Team Meeting Minutes - 2014/06/06 Core Team Meeting Minutes - 2014/04/25 Core Team Meeting Minutes - 2014/04/04 Ember 1.5.0 and 1.6 Beta Released Core Team Meeting Minutes - 2014/03/07 Core Team Meeting Minutes - 2014/03/14 Core Team Meeting Minutes - 2014/03/21 Core Team Meeting Minutes - 2014/02/28 Core Team Meeting Minutes - 2014/02/21 Core Team Meeting Minutes - 2014/02/14 Ember 1.4.0 and 1.5 Beta Released Core Team Meeting Minutes - 2014/01/27 Core Team Meeting Minutes - 2014/01/31 Core Team Meeting Minutes - 2014/02/07 Core Team Meeting Minutes - 2014/01/17 Core Team Meeting Minutes - 2014/01/03 Ember 1.3.0 and 1.4 Beta Released Core Team Meeting Minutes - 2013/12/20 Core Team Meeting Minutes - 2013/12/06 Ember 1.2.0 and 1.3 Beta Released Ember 1.1.2 Released Ember 1.1.1 and 1.2 Beta Released Ember 1.0 Released Ember 1.0 RC8 Released Ember 1.0 RC7 Released Ember 1.0 RC6.1, RC5.1, RC4.1, RC3.1, RC2.1 RC1.1 Released Ember 1.0 RC6 Ember 1.0 RC5 Ember 1.0 RC4 Ember 1.0 RC3 Announcing the Ember.js Security Policy Ember 1.0 RC2 Ember 1.0 RC Ember 1.0 Prerelease 2 Ember 1.0 Prerelease
How To Todo In Ember Template Lint
2021-02-02 · via Ember.js Blog

Introduction

At the time of this writing, this feature is available in ember-template-lint@3.0.0-beta.3.

The new todo feature in the ember-template-lint addon provides a new option to the existing states for linting rules.

With this new functionality, linting issues can be converted into a todo and developers can strategically plan the work to resolve issues in existing code. A todo can be set to automatically become a warning, then an error with the use of a supporting feature called decay days.

todo, warning, error

Previously, running the lint:hbs script (default in an Ember app) would cause ember-template-lint to run on all of the .hbs files, and return a result that included number of warnings and number of errors found. a terminal showing results that include 2 errors and 0 warnings

Now, however, we have a new option—we can also include number of todos. First, update the lint:hbs script in the package.json file to use the --include-todo flag (we want to be reminded that we have todos!):

"lint:hbs": "ember-template-lint . --include-todo",

Next, run the command yarn lint:hbs again: a terminal showing 2 errors, 0 warnings, and 0 todos

Note: ember-template-lint also takes a --quiet flag, which won't print any warnings or todos—only errors.

Along with the ability to create todos out of currently failing rules, some options can be set to decide the number of days before the todo turns into a warning and then into an error.

Why, though?

This new feature is intended to help apps at a large scale. It can be tricky to update a dependency like ember-template-lint when it includes a new rule, due to a number of factors involved. Taking in a new version of the linter can mean communication and coordination about the new rule(s). The larger your app is and the more developers you have, the more work this can be. For global companies that use Ember, there might even be a committee whose sole focus is to make decisions about linting rules!

While the pending feature gave us some of the desired functionality, it didn't ensure that teams would have support to fix existing issues. Issues could stay "pending" forever. The todo feature replaces the pending feature so that, when we introduce new linting rules, teams can remind one another to dedicate time to fix issues.

Perhaps a visualization would also be useful: a chart that shows how existing code receives a todo, while new code must follow the linting rules.

All new code is immediately supported by new linting rules; existing code can have a timeline to provide a fix.

We can even take a step further and customize the number of days to fix on a rule-by-rule basis. Super useful!

Step 1: Strategize

You'll want to think about how you want to approach all of the linting rules. Do you want all rules to be treated the same way, or do you want to apply decay days by rule? The linter gives you options for both.

All rules (generic setting)

It's possible that you don't care what the error is; all todos should have 15 days before they turn into a warning, and 30 days before they turn into an error. To do this, add this to the package.json file:

{
  "lintTodo": {
    "decayDays": {
      "warn": 15,
      "error": 30
    }
  }
}

The default values will vary from team to team. In essence, the values should be reasonable for teams to methodically work on past issues, but not too large that the issues will be forgotten. It should feel like a little bit of a stretch, but not stressful.

Once the generic settings are in the package.json file, run yarn ember-template-lint . --update-todo (or, yarn lint:hbs --update-todo) and any linting issue that is found will have a todo created for it.

Increasing specificity by rule

It's also possible that you'd want to specify that a particular rule needs to be fix with more immediacy. In that case, you'd want to run that rule by itself. Let's use the no-nested-interactive rule as an example:

yarn ember-template-lint app/ --no-config-path --no-inline-config --rule 'no-nested-interactive:error' --update-todo --todo-days-to-warn=7 --todo-days-to-error=14

Let's break down what this command does:

  • yarn ember-template-lint app/ : "run the linter on the app folder"
  • --no-config-path : "ignore the .template-lintrc.js file"
  • --no-inline-config : "also, ignore instances where the rule has been supressed inline"
  • --rule 'no-nested-interactive:error' : "specifically, only run the no-nested-interactive rule and throw an error if it finds these issues"
  • --update-todo : "create a todo if this issue is found"
  • --todo-days-to-warn=7 : "in the created todo, automatically change the todo to a warning after 7 days"
  • --todo-days-to-error=14 : "in the created todo, automatically change the warning to an error after 14 days"

Zoey says...accessibility!

If your company has decided to make more inclusive products, you may want to set the decay days based on the rule itself.

Typically, accessibility (a11y) bugs are divided up into categories based on impact to the user: blocker, critical, major and minor (results may vary).

Looking at the documentation for each the a11y-related rules in ember-template-lint, you could then determine the rule's category, and determine the number of days to warn/error accordingly.

For more ideas about how this could work, ping the #topic-a11y channel in the Ember Discord community chat.

Step 2: Plan For Accountability

After running the linter and creating all of the todos, a .lint-todo folder will appear in the root directory of the project. This is where you'll find the specifics about which file is failing which rule so that you can fix the issues.

If you run the linter after an issue is fixed, the linter will tell you that an issue has been resolved. To remove the resolved todo, use the --fix flag:

yarn lint:hbs --fix

Note: using --fix will also fix any items that are automatically fixable, which may cause an unwanted result. For example, the require-button-type rule may add a default type="button" to the <button> elements, but may not automatically respect the prettier or beautify configuration of the project.

The .lint-todo folder should get checked in to the project's version control system, and teams should do a periodic review to ensure that they are fixing the todos and not changing the due dates. Have a professional agreement with the other members of your team, and stay committed to fixing those todos.

Step 3: Enjoy Improved Code!

By taking advantage of the new todo feature, dev teams are setting themselves up for success and higher quality code. If you have any questions about this new feature, check out the #e-template-lint channel in the Ember Discord community chat, or file an issue on the project's repo.