<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by inapeace0 on Medium]]></title>
        <description><![CDATA[Stories by inapeace0 on Medium]]></description>
        <link>https://medium.com/@rifantechguy55?source=rss-9bd2ea29b9c1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*eJGi0W2iloktcOLt8J9Heg.png</url>
            <title>Stories by inapeace0 on Medium</title>
            <link>https://medium.com/@rifantechguy55?source=rss-9bd2ea29b9c1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 08:53:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rifantechguy55/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Setting Up a Next.js 13 Project with ESLint and Prettier]]></title>
            <link>https://medium.com/@rifantechguy55/setting-up-a-next-js-13-project-with-eslint-and-prettier-735c3ccfd26c?source=rss-9bd2ea29b9c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/735c3ccfd26c</guid>
            <category><![CDATA[prettier]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[eslint]]></category>
            <category><![CDATA[tailwind]]></category>
            <dc:creator><![CDATA[inapeace0]]></dc:creator>
            <pubDate>Sun, 23 Jul 2023 11:21:36 GMT</pubDate>
            <atom:updated>2023-07-23T11:30:36.045Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*LKi2QhWCMqroy9Olz3A4Ow.png" /></figure><p>In this tutorial, we will walk through the process of setting up a fresh Next.js 13 project with ESLint and Prettier. We’ll also configure Tailwind CSS for styling. By the end, you’ll have a clean and well-formatted codebase that is ready to be developed further.</p><p>Let’s get started!</p><h3>Step 1: Create a New Next.js Project</h3><p>To begin, let’s create a new Next.js project using the automatic setup provided in the <a href="https://nextjs.org/docs/getting-started#automatic-setup">Next.js documentation</a>.</p><p>Open your terminal and run the following command:</p><pre>pnpm create next-app --typescript</pre><p>This will create a new Next.js project with TypeScript support.</p><h3>Step 2: Install Prettier</h3><p>Once our Next.js project is set up, we need to install Prettier as a development dependency.</p><p>Run the following command to install Prettier:</p><pre>pnpm add -D prettier@2.8.8</pre><p><strong>🎯 The Tailwind sorting plugin is currently not compatible with Prettier version 3.0.0. So, you will need to use Prettier version 2.8.8.</strong></p><h3>Step 3: Set up Prettier and ESLint without Conflicts</h3><p>To ensure that Prettier and ESLint work together seamlessly, we will use eslint-config-prettier.</p><p>Install eslint-config-prettier by running the following command:</p><pre>pnpm add -D eslint-config-prettier</pre><p>After installing, open your existing ESLint configuration file (.eslintrc.json or .eslintrc.js) and add the following line:</p><pre>{<br>  &quot;extends&quot;: [&quot;next&quot;, &quot;prettier&quot;]<br>}</pre><h3>Step 4: Install and Configure Tailwind CSS</h3><p>Now, let’s install and configure Tailwind CSS for our Next.js project.</p><p>First, install Tailwind CSS, PostCSS, and Autoprefixer by running the following command:</p><pre>pnpm add -D tailwindcss postcss autoprefixer</pre><p>Next, generate the tailwind.config.js and postcss.config.js files by running:</p><pre>pnpm tailwindcss init -p</pre><p>In the generated tailwind.config.js file, find the content property and add the paths to all of your template files. For example:</p><pre>module.exports = {<br>  content: [<br>    &quot;./app/**/*.{js,ts,jsx,tsx}&quot;,<br>    &quot;./pages/**/*.{js,ts,jsx,tsx}&quot;,<br>    &quot;./components/**/*.{js,ts,jsx,tsx}&quot;,<br><br>    // Or if using `src` directory:<br>    &quot;./src/**/*.{js,ts,jsx,tsx}&quot;,<br>  ],<br>  theme: {<br>    extend: {},<br>  },<br>  plugins: [],<br>}</pre><h3>Step 5: Add Tailwind CSS Directives</h3><p>To include Tailwind CSS in your project, open your global CSS file (e.g., globals.css) and add the following directives:</p><pre>@tailwind base;<br>@tailwind components;<br>@tailwind utilities;</pre><h3>Step 6: Automatically Sort Tailwind Classes with Prettier</h3><p>To automatically sort Tailwind CSS classes using Prettier, we need to install the prettier-plugin-tailwindcss.</p><p>Install the plugin by running the following command:</p><pre>pnpm add -D prettier-plugin-tailwindcss</pre><p>Then, create a .prettierrc.json file in your project&#39;s root directory:</p><pre>touch .prettierrc.json</pre><p>Finally, add the installed plugin to your .prettierrc.json config file:</p><pre>{<br>  &quot;trailingComma&quot;: &quot;es5&quot;,<br>  &quot;semi&quot;: true,<br>  &quot;tabWidth&quot;: 2,<br>  &quot;singleQuote&quot;: true,<br>  &quot;jsxSingleQuote&quot;: true,<br>  &quot;plugins&quot;: [&quot;prettier-plugin-tailwindcss&quot;]<br>}</pre><h3>Step 7: Configure scripts</h3><p>To use the Prettier that we’ve set, open the package.json file and modify it like the below.</p><pre>&quot;scripts&quot;: {<br>  ...<br>  &quot;format&quot;: &quot;prettier --check --ignore-path .gitignore .&quot;,<br>  &quot;format:fix&quot;: &quot;prettier --write --ignore-path .gitignore .&quot;<br>}</pre><p>Congratulations! You have successfully set up a Next.js 13 project with ESLint, Prettier, and Tailwind CSS. Now you can enjoy clean and formatted code while building your web application.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=735c3ccfd26c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to develop a Typescript Library]]></title>
            <link>https://medium.com/@rifantechguy55/how-to-develop-a-typescript-library-ade8d329636?source=rss-9bd2ea29b9c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/ade8d329636</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[inapeace0]]></dc:creator>
            <pubDate>Sat, 24 Jun 2023 08:58:59 GMT</pubDate>
            <atom:updated>2023-06-24T08:59:57.616Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*CN1FnZmaMJ2Ht7FUVyrPFA.png" /></figure><p>“I’m a beginner for Typescript, and I’d like to make my first custom TS library. But I don’t know how to do it”. This is you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*r3XzMnjRWH0Cvtf408Ahsg.gif" /></figure><p>Don’t worry about it. Look it further!!! I’m here, and I will teach you one by one. Never mind!!!</p><h3>Step 1: Setup tsconfig.json</h3><p>Create a project folder, in this tutorial we’ll call it hello-world. Then proceed to create a tsconfig.json in hello-world. Your tsconfig.json file should look somewhat like this:</p><p>hello-world/tsconfig.json</p><pre>{<br>  &quot;compilerOptions&quot;: {<br>    &quot;module&quot;: &quot;commonjs&quot;,<br>    &quot;target&quot;: &quot;es2015&quot;,<br>    &quot;declaration&quot;: true,<br>    &quot;outDir&quot;: &quot;./dist&quot;<br>  },<br>  &quot;include&quot;: [<br>    &quot;src/**/*&quot;<br>  ]<br>}</pre><p><strong>Pretty much like a setup for a non-library project, but with one important addition: You need to add the </strong><strong>&quot;declaration&quot;: true flag. This will generate the </strong><strong>.d.ts files (aka declaration files) which contain the types of your code. This way, if someone is using your library and they also use TypeScript, they get the benefits of typesafety and autocomplete!</strong></p><p><strong>Regarding the other options, let’s quickly go through those: The </strong><a href="https://www.tsmean.com/articles/learn-typescript/typescript-module-compiler-option/"><strong>module compiler option</strong></a><strong> </strong><strong>&quot;module&quot;: &quot;commonjs&quot; is required if you want your code to run seamlessly with most current node.js applications. Replace this with </strong><strong>&quot;module&quot;: &quot;esnext&quot; if you&#39;re building a library for the browser. </strong><strong>&quot;target&quot;: &quot;es2015&quot; specifies which version of JavaScript your code will get transpiled to. This needs to be aligned with the oldest version of node.js (or the oldest browser) you want to support. Choosing es2015 as the compile target makes your library compatible with node.js version 8 and upwards. </strong><strong>&quot;outDir&quot;: &quot;./dist&quot; will write your compiled files into the dist folder and the </strong><strong>include option specifies where your source code lives.</strong></p><h3>Step 2: Implement your library</h3><p>Proceed in the same way, as if you weren’t writing a library. Create a src folder and put all the source files of your library (application logic, data, and assets) there.</p><p>For this demo, we’ll setup a silly hello-world.ts file, that looks like so:</p><p>hello-world/src/hello-world.ts</p><pre>export function sayHello() {<br>  console.log(&#39;hi&#39;)<br>}<br>export function sayGoodbye() {<br>  console.log(&#39;goodbye&#39;)<br>}</pre><h3>Step 3: Create an index.ts file</h3><p>Add an index.ts file to your src folder. Its purpose is to export all the parts of the library you want to make available for consumers. In our case it would simply be:</p><p>hello-world/src/index.ts</p><pre>export {sayHello, sayGoodbye} from &#39;./hello-world&#39;</pre><p>The consumer would be able to use the library later on like so:</p><p>someotherproject/src/somefile.ts</p><pre>import {sayHello} from &#39;hwrld&#39;<br>sayHello();</pre><p>You see that we have a new name here, “hwrld”, we haven’t seen anywhere yet. What is this name? It’s the name of the library you’re gonna publish to npm also known as the package name!</p><h3>Step 4: Configure the package.json</h3><p>The package name is what the consumer is going to use to import functionality from your library later on. For this demo I have have chosen hwrld since it was still available on npm. The package name is usually right at the top of the package.json. The whole package.json would look like so:</p><p>hello-world/package.json</p><pre>{<br>  &quot;name&quot;: &quot;hwrld&quot;,<br>  &quot;version&quot;: &quot;1.0.0&quot;,<br>  &quot;description&quot;: &quot;Can log \&quot;hello world\&quot; and \&quot;goodbye world\&quot; to the console!&quot;,<br>  &quot;main&quot;: &quot;dist/index.js&quot;,<br>  &quot;types&quot;: &quot;dist/index.d.ts&quot;,<br>  &quot;files&quot;: [<br>    &quot;/dist&quot;<br>  ]<br>}</pre><p>If you don’t have a package yet you can create one with npm init and it will guide you through the process. Remember, the package name you choose will be used by people for their imports, so choose wisely!</p><p>There’s also one all-important flag in this package.json: You have to declare where to find the type declarations! This is done using &quot;types&quot;: &quot;dist/index.d.ts&quot; Otherwise the consumer won&#39;t find your module!</p><p>The final property files helps you to <strong>whitelist</strong> the files you want to ship to the npm registry. This is usually a <a href="https://medium.com/@jdxcode/for-the-love-of-god-dont-use-npmignore-f93c08909d8d">much easier and safer route than using the `.npmignore` file</a>!</p><h3>Step 5: Publish to npm</h3><p>To publish your first version to npm run:</p><pre>tsc<br>npm publish</pre><p>Now you’re all set to go! Consume your library anywhere you want by running:</p><pre>npm install --save hwrld</pre><p>and consume it using</p><pre>import {sayHello} from &#39;hwrld&#39;<br>sayHello();</pre><p>For subsequent releases, use the semvar principle. When you make a patch / bugfix to your library, you can run npm version patch, for new features run npm version minor and on breaking changes of your api run npm version major.</p><p>You can also refer this github repo.</p><p><a href="https://github.com/CaCaBlocker/ts-sample-modules">https://github.com/CaCaBlocker/ts-sample-modules</a></p><p>The below link will teach you how to create and publish your first npm package, and you will certainly have a good sense of it.</p><p><a href="https://www.freecodecamp.org/news/how-to-create-and-publish-your-first-npm-package/">https://www.freecodecamp.org/news/how-to-create-and-publish-your-first-npm-package/</a></p><p>Thanks for your time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ade8d329636" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>