<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: xcatliu</title>
    <description>The latest articles on DEV Community by xcatliu (@xcatliu).</description>
    <link>https://dev.to/xcatliu</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F301049%2Fa53a6d43-c83e-4c3b-83dd-a42839504dcd.png</url>
      <title>DEV Community: xcatliu</title>
      <link>https://dev.to/xcatliu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/xcatliu"/>
    <language>en</language>
    <item>
      <title>A real deno app: Pagic</title>
      <dc:creator>xcatliu</dc:creator>
      <pubDate>Thu, 21 May 2020 12:09:10 +0000</pubDate>
      <link>https://dev.to/xcatliu/a-real-deno-app-pagic-4816</link>
      <guid>https://dev.to/xcatliu/a-real-deno-app-pagic-4816</guid>
      <description>&lt;p&gt;The easiest way to generate static html page from markdown, built with Deno! 🦕&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/xcatliu/pagic"&gt;GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Markdown + Layout =&amp;gt; HTML&lt;/li&gt;
&lt;li&gt;React component as a page&lt;/li&gt;
&lt;li&gt;Copy static files&lt;/li&gt;
&lt;li&gt;Sub pages and layouts&lt;/li&gt;
&lt;li&gt;Front matter&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install deno https://deno.land/#installation&lt;/span&gt;
curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://deno.land/x/install/install.sh | sh
&lt;span class="c"&gt;# Install pagic&lt;/span&gt;
deno &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--unstable&lt;/span&gt; &lt;span class="nt"&gt;--allow-read&lt;/span&gt; &lt;span class="nt"&gt;--allow-write&lt;/span&gt; &lt;span class="nt"&gt;--allow-net&lt;/span&gt; https://raw.githubusercontent.com/xcatliu/pagic/master/pagic.ts
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Markdown + Layout =&amp;gt; HTML
&lt;/h3&gt;

&lt;p&gt;Let's say we have a project like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docs/
├── public/
└── src/
    ├── _layout.tsx
    └── index.md
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;src/_layout.tsx&lt;/code&gt; is a simple react component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// @deno-types="https://deno.land/x/types/react/v16.13.1/react.d.ts"&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://dev.jspm.io/react@16.13.1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PagicLayout&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://raw.githubusercontent.com/xcatliu/pagic/master/pagic.ts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Layout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;PagicLayout&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;content&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;html&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;head&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;title&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;title&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;meta&lt;/span&gt; &lt;span class="na"&gt;charSet=&lt;/span&gt;&lt;span class="s2"&gt;"utf-8"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;head&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;html&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Layout&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;src/index.md&lt;/code&gt; is a simple markdown file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Pagic&lt;/span&gt;

The easiest way to generate static html page from markdown, built with Deno! 🦕
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;pagic build
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We'll get an &lt;code&gt;index.html&lt;/code&gt; file in &lt;code&gt;public&lt;/code&gt; directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docs/
├── public/
|   └── index.html
└── src/
    ├── _layout.tsx
    └── index.md
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The content should be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Pagic&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"utf-8"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;article&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;h1&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"pagic"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Pagic&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;The easiest way to generate static html page from markdown, built with Deno! 🦕&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Other features please see &lt;a href="https://github.com/xcatliu/pagic"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

</description>
      <category>deno</category>
      <category>node</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>How eslint-config-alloy become the third welcomed ESLint config in the world</title>
      <dc:creator>xcatliu</dc:creator>
      <pubDate>Thu, 26 Dec 2019 05:05:03 +0000</pubDate>
      <link>https://dev.to/xcatliu/how-eslint-config-alloy-become-the-third-welcomed-eslint-config-in-the-world-ai2</link>
      <guid>https://dev.to/xcatliu/how-eslint-config-alloy-become-the-third-welcomed-eslint-config-in-the-world-ai2</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/AlloyTeam/eslint-config-alloy" rel="noopener noreferrer"&gt;eslint-config-alloy&lt;/a&gt; is an ESLint config which created by Tencent AlloyTeam. Since the first version was released in August 2017, it has unknowingly gained 1.3k stars, and becoming the third-ranked ESLint config in the world (first is airbnb and second is standard).&lt;/p&gt;

&lt;p&gt;For more than two years, we have rarely promoted it, mainly relying on word of mouth and growing naturally. So what’s so special about eslint-config-alloy?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F3l1us1vmcdlwz5wyp7tz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F3l1us1vmcdlwz5wyp7tz.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Philosophy
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Let &lt;a href="https://prettier.io/" rel="noopener noreferrer"&gt;Prettier&lt;/a&gt; handle style-related rules&lt;/li&gt;
&lt;li&gt;Inherit &lt;a href="https://eslint.org/docs/about/#philosophy" rel="noopener noreferrer"&gt;ESLint's philosophy&lt;/a&gt; and help everyone build their own rules&lt;/li&gt;
&lt;li&gt;High degree of automation: advanced rules management, test as document as &lt;a href="https://alloyteam.github.io/eslint-config-alloy/" rel="noopener noreferrer"&gt;website&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Keep up with the times, follow up the latest rules as soon as possible&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Let &lt;a href="https://prettier.io/" rel="noopener noreferrer"&gt;Prettier&lt;/a&gt; handle style-related rules
&lt;/h3&gt;

&lt;p&gt;Prettier is a code formatting tool that offers fewer options but is more professional than the style-related rules in ESLint.&lt;/p&gt;

&lt;p&gt;Now that Prettier has become a necessary tool in front-end projects, eslint-config-alloy does not need to maintain the style-related rules in ESLint anymore, so we completely removed all Prettier related rules in the v3 version, and use ESLint to check logical errors which it's good at.&lt;/p&gt;

&lt;p&gt;As for whether two spaces or four spaces are used for indentation and whether there is a semicolon at the end, you can configure it in the project's &lt;code&gt;.prettierrc.js&lt;/code&gt;. Of course, we also provide a recommended Prettier configuration for your reference.&lt;/p&gt;

&lt;h3&gt;
  
  
  Inherit &lt;a href="https://eslint.org/docs/about/#philosophy" rel="noopener noreferrer"&gt;ESLint's philosophy&lt;/a&gt; and help everyone build their own rules
&lt;/h3&gt;

&lt;p&gt;Don't you remember how ESLint defeated JSHint and became the most popular JS code inspection tool? It is because of the plugin and configuration that ESLint advocates, which meets the individual needs of different technology stacks of different teams.&lt;/p&gt;

&lt;p&gt;Therefore, eslint-config-alloy also inherits the philosophy of ESLint. It will not emphasize the need to use our config. Instead, we help you to make your own config by reference our completed documents, examples, tests, websites, etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  High degree of automation: advanced rules management, test as document as &lt;a href="https://alloyteam.github.io/eslint-config-alloy/" rel="noopener noreferrer"&gt;website&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Relentless push automation&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;eslint-config-alloy uses a high degree of automation to hand over all processes that can be managed automatically, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Through greenkeeper and travis-ci, automatically check whether ESLint and related plugins have new versions, and if there are new rules in the new version which we need to add&lt;/li&gt;
&lt;li&gt;Automatically check if our rules include Prettier rules&lt;/li&gt;
&lt;li&gt;Automatically check if our rules include deprecated rules&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In addition, through automated scripts, we can even divide and conquer thousands of ESLint configuration files, and each rule is managed in a separate directory:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integrate single configurations into a final configuration through a script&lt;/li&gt;
&lt;li&gt;The description and reason in single configurations are built into a &lt;a href="https://alloyteam.github.io/eslint-config-alloy/" rel="noopener noreferrer"&gt;website&lt;/a&gt; by script for everyone to view&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;bad.js&lt;/code&gt; and&lt;code&gt;good.js&lt;/code&gt; in a single configuration are output to &lt;a href="https://alloyteam.github.io/eslint-config-alloy/" rel="noopener noreferrer"&gt;website&lt;/a&gt; by script, and you can even see the error message (which are run in a real ESLint script) in the &lt;code&gt;bad.js&lt;/code&gt; of &lt;a href="https://alloyteam.github.io/eslint-config-alloy/" rel="noopener noreferrer"&gt;website&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The benefits of this are very obvious, test as document as &lt;a href="https://alloyteam.github.io/eslint-config-alloy/" rel="noopener noreferrer"&gt;website&lt;/a&gt;. We can maintain the rules and tests in one place. Other tasks are handed over to the automated script, which greatly reduces the maintenance cost. In short, when we have a new rule to add, we only need to write three files &lt;code&gt;test/index/another-rule/.eslintrc.js&lt;/code&gt;, &lt;code&gt;test/index/another-rule/bad.js&lt;/code&gt;, &lt;code&gt;test/index/another-rule/good.js&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keep up with the times, follow up the latest rules as soon as possible
&lt;/h3&gt;

&lt;p&gt;ESLint is updated very quickly, there is a new version almost every week, sometimes there are new rules, sometimes existing rules are deprecated, and related plug-ins (React/Vue/TypeScript) will be updated from time to time. Without automation tools, it is difficult follow up.&lt;/p&gt;

&lt;p&gt;And eslint-config-alloy can receive the &lt;a href="https://github.com/AlloyTeam/eslint-config-alloy/issues/127" rel="noopener noreferrer"&gt;greenkeeper issue&lt;/a&gt; as soon as possible through the above automation tools, tell us which plugin has been updated, and the &lt;a href="https://travis-ci.org/AlloyTeam/eslint-config-alloy/builds/616828848" rel="noopener noreferrer"&gt;travis-ci build log&lt;/a&gt; will tell us which rules need to be added:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.v2ex.co%2FzDK6Uao4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.v2ex.co%2FzDK6Uao4.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this way, we can follow the latest rules in time when the front-end community is changing rapidly, and always keep the vitality and advanced of eslint-config-alloy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Q &amp;amp; A
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why anthor ESLint config
&lt;/h3&gt;

&lt;p&gt;In fact, our team initially used airbnb rules, but because it was too strict, some rules still needed to be personalized, which led to more and more changes in the future, and finally decided to maintain a new set. After more than two years of polishing, eslint-config-alloy is now very mature and progressive, and has been welcomed by many teams inside and outside the company.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why not standard
&lt;/h3&gt;

&lt;p&gt;The standard specification believes that everyone should not waste time in personalized specifications, but the entire community should unify a specification. This statement makes some sense, but it runs counter to ESLint's design philosophy. Don't you remember how ESLint defeated JSHint and became the most popular JS code inspection tool? It is because of the plugin and configuration that ESLint advocates, which meets the individual needs of different technology stacks of different teams.&lt;/p&gt;

&lt;p&gt;Therefore, eslint-config-alloy also inherits the philosophy of ESLint. It will not emphasize the need to use our config. Instead, we help you to make your own config by reference our completed documents, examples, tests, websites, etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why not airbnb
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;eslint-config-alloy has officially maintained vue, typescript and react+typescript rules. In contrast, airbnb's vue and typescript are maintained by third parties.&lt;/li&gt;
&lt;li&gt;Progressive to ensure that we can keep up with the times, as mentioned earlier&lt;/li&gt;
&lt;li&gt;Convenient personalization, including explanations and website examples&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Looks good, but I still choose airbnb
&lt;/h3&gt;

&lt;p&gt;It ’s okay, eslint-config-alloy believes that different teams and projects can have different configurations from the design concept. Although you choose to use airbnb, you can still come to us &lt;a href="https://alloyteam.github.io/eslint-config-alloy/" rel="noopener noreferrer"&gt;website&lt;/a&gt; when you have personalized configuration needs.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
      <category>react</category>
      <category>vue</category>
    </item>
  </channel>
</rss>
