<?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>Forem: konnichiwa sekai</title>
    <description>The latest articles on Forem by konnichiwa sekai (@k13i).</description>
    <link>https://forem.com/k13i</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%2F617308%2F2da75f5d-a1bf-4946-9411-9e050d79fe39.jpeg</url>
      <title>Forem: konnichiwa sekai</title>
      <link>https://forem.com/k13i</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/k13i"/>
    <language>en</language>
    <item>
      <title>How To Configure ESLint &amp; Prettier in React PJ</title>
      <dc:creator>konnichiwa sekai</dc:creator>
      <pubDate>Sat, 12 Nov 2022 00:23:24 +0000</pubDate>
      <link>https://forem.com/k13i/how-to-configure-eslint-prettier-in-react-pj-2ogj</link>
      <guid>https://forem.com/k13i/how-to-configure-eslint-prettier-in-react-pj-2ogj</guid>
      <description>&lt;p&gt;I had chance to introduce and set up ESLint &amp;amp; prettier in project while working. So, the purpose of writing this post is simply memorandum and output for my sake. Please be aware that this post has inaccurate information. I will fix it As I realize&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;&lt;em&gt;Introduce ESLint&lt;/em&gt;&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Install ESLint&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install eslint --save-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the project is created by "create-react-up", Eslint has been installed already. You should not install again because it may cause some error later.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Set up ESLint&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init @eslint/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.eslintrc.json will be generated after You answer interactive questions on terminal.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Add .eslintignore&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Write one line below into .eslintignore to prevent ESLint from linting files in node_modules.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node_modules/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  &lt;strong&gt;&lt;em&gt;Introduce Prettier&lt;/em&gt;&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Install Prettier&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev --save-exact prettier
npm install --save-dev eslint-config-prettier
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;strong&gt;Edit .eslintrc&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;*Exsample below is JSON format.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"extends":[
   "xxxxx",
   "prettier" // make sure to add om the last line.
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;strong&gt;Check your settings has no confliction&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx eslint-config-prettier ./src/**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Execute the command above&lt;/p&gt;

&lt;p&gt;If you see response like below, you can confirm the setting has no confliction&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;No rules that are unnecessary or conflict with Prettier were found.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Add .prettierignore&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Write one line below into .prettierignore to prevent prettier from formatting files in node_modules.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node_modules
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Add .prettierrc&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can setup your own formatting rule in this file.&lt;br&gt;
If you do not create this file and configure, those setting below are applied as default&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "printWidth": 80,
  "tabWidth": 2,
  "useTabs": false,
  "semi": true,
  "singleQuote": false,
  "quoteProps": "as-needed",
  "jsxSingleQuote": false,
  "trailingComma": "none",
  "bracketSpacing": true,
  "jsxBracketSameLine": false,
  "arrowParens": "avoid",
  "rangeStart": 0,
  "rangeEnd": Infinity,
  "parser": "none",
  "filepath": "none",
  "requirePragma": false,
  "insertPragma": false,
  "proseWrap": "preserve",
  "htmlWhitespaceSensitivity": "css",
  "vueIndentScriptAndStyle": false,
  "endOfLine": "auto",
  "embeddedLanguageFormatting": "auto"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>react</category>
      <category>memorandum</category>
    </item>
    <item>
      <title>Introduction of Pseudocode</title>
      <dc:creator>konnichiwa sekai</dc:creator>
      <pubDate>Thu, 11 Aug 2022 12:04:00 +0000</pubDate>
      <link>https://forem.com/k13i/introduction-of-pseudocode-31ko</link>
      <guid>https://forem.com/k13i/introduction-of-pseudocode-31ko</guid>
      <description>&lt;p&gt;How do often you write code? In my case, I often write code thinking logic in my head. However, it is inefficient practice especially when the code has complicated logic. How do you explain the logic to someone who has different programing language background? You might be distracted by the difference of each language syntax. That is the reason why I started searching technique to create a draft of code before writing and found pseudo code. So, I want to output what I have learned in this article.&lt;/p&gt;

&lt;p&gt;Just so there's no confusion, &lt;br&gt;
There is no universal "standard" for this code. Each textbook may have their own personal style of notation. Pseudocode is not a rigorous notation, since it is read by other people, not by the computer. Please read this article only as a guide.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;br&gt; ❓ What Is Pseudo Code?
&lt;/h3&gt;

&lt;p&gt;It is a simpler version of programming code in plain English before it is implemented in a specific programming language.&lt;br&gt;
You can use it to create outline of the code you want to write.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;br&gt; 👍 Advantage
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Pseudocode is understood by the programmers of all types of programming language.&lt;/li&gt;
&lt;li&gt;It enables the programmer to concentrate only on the algorithm part of the code development while writing.&lt;/li&gt;
&lt;li&gt;You can save time for coding as conceptual logic have already been fixed.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;br&gt; ⚠️ Disadvantage
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It doesn't visualize logic like flowchart does.&lt;/li&gt;
&lt;li&gt;Notation varies widely depending on the writer.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;br&gt; 🔑 Main structures in pseudo code
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SEQUENCE&lt;/strong&gt; represents linear tasks sequentially performed one after the other.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SELECTION&lt;/strong&gt; performs actions based on the condition given&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ITERATION&lt;/strong&gt; allows for multiple execution of statement&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;br&gt; 📝 Tips for clear pseudo code
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Write only one task per line&lt;/li&gt;
&lt;li&gt;Capitalize initial keyword&lt;/li&gt;
&lt;li&gt;Indent to show hierarchy&lt;/li&gt;
&lt;li&gt;End multiline structures&lt;/li&gt;
&lt;li&gt;Keep your statements language-independent&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  &lt;br&gt; 🐾 1. Write only one task per line
&lt;/h4&gt;

&lt;p&gt;You should only write one task for one line to make your pseudo code more readable. Here is example code below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EX_BEFORE

Read name, product_price, amount, tax_rate
sales = product_price * amount, tax = sales * tax_rate
Write name, sales, sales + tax
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EX_AFTER

READ name, product price, amount, tax_rate
sales = product_price * amount
tax = sales * tax_rate
sales_with_tax = sales + tax
WRITE name, sales, sales_with_tax
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;br&gt; 🐾 2. Capitalize initial keyword
&lt;/h4&gt;

&lt;p&gt;In the example above, READ and WRITE are in caps. Keywords below are examples you should write in caps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;READ, WRITE, IF, ELSE, ENDIF, WHILE, ENDWHILE, REPEAT, UNTIL&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;br&gt; 🐾 3. Indent to show hierarchy
&lt;/h4&gt;

&lt;p&gt;We will use a particular indentation pattern in each of the design structures:&lt;br&gt;
&lt;br&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SEQUENCE&lt;/strong&gt; : keep statements in sequence all starting in the same column.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SELECTION&lt;/strong&gt; : indent the statements inside the selection structure, but not the keywords that form the selection&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ITERATION&lt;/strong&gt; : indent the statements inside the loop, but not the keywords that form the loop
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EX

READ name, result
IF result &amp;gt;= 80
   message = "You passed"
ELSE
   message = "You failed"
ENDIF
WRITE message
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  &lt;br&gt; 🐾 4. End multiline structures
&lt;/h4&gt;

&lt;p&gt;See how IF statement ends with ENDIF in the above example. Regardless of type of keyword, whatever starts the structure shoud end with &lt;strong&gt;END-KEYWORD&lt;/strong&gt;. For example, WHILE keyword ends with ENDWHILE and so on.&lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;br&gt; 🐾 5. Keep your statements language-independent
&lt;/h4&gt;

&lt;p&gt;Avoid using the special features available in the language you plan to write the program in as much as you can. If you are SURE it will be written in that language, then you can use the features. However, if not, it may cost you extra time or work.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;br&gt; 💡 Examples of pseudo code
&lt;/h3&gt;
&lt;h4&gt;
  
  
  &lt;br&gt; 🐾 If statement
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;READ name, result
IF result = 100
   message = "Perfect!"
ELSEIF result &amp;gt;= 80
   message = "You passed"
ELSE
   message = "You failed"
ENDIF
WRITE message
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  &lt;br&gt; 🐾 Nested if
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;READ name,sex,is_married
IF sex = male
   WRITE "Hello Mr. " + name
ELSE
   IF is_married = true
      WRITE "Hello Mrs. " + name
   ELSE
      WRITE "Hello Ms. " + name
   ENDIF
ENDIF
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  &lt;br&gt; 🐾 WHILE
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;count = 0
WHILE count &amp;lt; 10
  ADD 1 to count
  WRITE count
ENDWHILE
WRITE “The end”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;You can separate sequence into modules&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;count = 0
WHILE count &amp;lt; 10
   DO PROCESS
ENDWHILE
WRITE “The end”

PROCESS
ADD 1 to count
WRITE count
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;br&gt; 🐾 REPEAT/UNTIL
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;count = 0
REPEAT
  ADD 1 to count
  WRITE count
UNTIL count &amp;gt;= 10
WRITE “The end”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;br&gt; 🐾 FOR
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FOR x = 1 to 10
  IF x % 2 = 0
    WRITE x + " is even"
  ELSE
    WRITE x + " is odd"
ENDFOR
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;br&gt; 🐾 CASE
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CASE Day OF
    1 : WRITE "Monday"
    2 : WRITE "Tuesday"
    3 : WRITE "Wednesday"
    4 : WRITE "Thursday"
    5 : WRITE "Friday"
    6 : WRITE "Saturday"
    7 : WRITE "Sunday"
    OTHERWISE OUTPUT "Day invalid"
ENDCASE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;br&gt; 🐔 In the end
&lt;/h3&gt;

&lt;p&gt;The techniques I introduced may not be the best practice. You have to figure out your own notation. But, I hope that this article helps you understand pseudo code and start using it.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;br&gt; 🎓 Reference
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://cs.wmich.edu/gupta/teaching/cs3310/lectureNotes_cs3310/PseudocodeBasics.pdf"&gt;PseudocodeBasics&lt;/a&gt;&lt;br&gt;
&lt;a href="https://builtin.com/data-science/pseudocode"&gt;Pseudocode: What It Is and How to Write It&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=cLRCz7gKsBo&amp;amp;t=204s"&gt;Types of Logic structure&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>productivity</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
