Git Product home page Git Product logo

git-validator's Introduction

Hi there 👋

  • 👨🏻‍💻 I'm a programmer who wants to make the world easier
    Project Stars Description
    web-ide GitHub stars 🖥️ An out-of-box web IDE containing many tools for an enjoyable coding experience.
    git-validator GitHub stars 📈 Git hooks and code style Validator.
    @rnm/tscx GitHub stars 🔧 A tiny tsc wrapper with many convenient options.
    typed-jest GitHub stars 🧪 An all-in-one test framework supporting TypeScript out-of-box.
    nest-boilerplate GitHub stars 🐈 A super tiny, simple and elegant Nest app starter template.
    react-boilerplate GitHub stars 🏕 An elegant React app starter template.
    sync-pnpm-deps GitHub stars Sync pnpm deps according to monorepo graph.
  • 📖 My tech blog is here
  • 🔭 I’m working on Alibaba currently and Bytedance formerly
  • 🌱 I’m currently learning React, T3 Stack, and framework design
  • 💬 Ask me about Node / TypeScript / JavaScript / Backend

git-validator's People

Contributors

github-actions[bot] avatar zanminkian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

git-validator's Issues

[feat]: suggestions for eslint-config

  • enable '@typescript-eslint/no-explicit-any': 'error'
  • enable '@typescript-eslint/no-non-null-assertion': 'error'
  • enable '@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'never' }] (should allow as unknown)
  • Ban types filed of exports in package.json.
  • Use the shortest relative path when import some package.
  • Files without extension should raise an error.
  • Disable camlecase and enable @typescript-eslint/naming-convention for ts file.
  • For monorepo, it should not install package to dependencies in the root package.json.
  • add rules to ban export =, import = require() and commonjs (require and module.exports) in ts file. antfu/eslint-config#167
  • antfu/eslint-config#159
  • ban ++ and --. antfu/eslint-config#182
  • block parseInt and parseFloat function. antfu/eslint-config#190
  • ban xxx.__proto__, use Object.getPrototype(xxx) instead.
  • add curly brackets after all if and for.
  • enable no-self-import
  • no declaration in ts file. Declaration should only be in *.d.ts file. antfu/eslint-config#217
  • ban const enum. check https://www.typescriptlang.org/docs/handbook/enums.html#const-enum-pitfalls
  • Ban too-deep parent import. Ban self folder file import via parent path. Importing file from parent folder is reasonable in some case. But Importing file from grandparent folder should be blocked. See no-relative-parent-imports.
  • Ban import xxx from './node_modules/xxx'.
  • Ban importing files ends with .d.ts, .d.js, .d.
  • Prevent to call require or import function and pass a variable. It should pass literal.
  • Ban code like +somevar for converting some var to numebr type. We should use Number(somevar) only.
  • Enable import/no-relative-packages.
  • Correct the space of generic type. See: https://github.com/antfu/eslint-config/blob/main/packages/eslint-plugin-antfu/src/rules/generic-spacing.test.ts.
  • When defining a function, we should add a space between the function name and the left bracket. Because it convenient for searching function usage excluding the function definition. antfu/eslint-config#168
  • ban public and private descriptor.(protected is useful in ts. And tc39 has no plan of implementing protected keyword.)

eslint配置能否被vscode-eslint插件识别?

eslint的配置在@git-validator/eslint-config中,是不是只有运行lint命令的时候,配置才生效?如果我在vscode编辑器中下载了vscode-eslint插件,在保存文件时自动校验,那插件能识别到@git-validator/eslint-config的配置吗

[docs]: add motivation

  1. Too many config files in the project root. Not easy enough for newer.
  2. Most of Node projects use the same config.
  3. Too many packages to install.
  4. In summary, too many steps to start up and too messy in the project root.
  5. Start committing -> validate the commit message -> validate code/doc/json -> format code/doc/json -> finish committing.

feat(eslint-config): support strict mode

Enable rules below when in strict mode:

  • enable '@typescript-eslint/no-explicit-any': 'error'
  • enable '@typescript-eslint/no-non-null-assertion': 'error'
  • enable '@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'never' }] (should allow as unknown)

prettier-plugin-tailwindcss

✖ npx git-validator -u:
[error] require() of ES Module /Users/xxx/Desktop/code/practice/getting-started-example/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.mjs not supported.
[error] Instead change the require of /Users/xxx/Desktop/code/practice/getting-started-example/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.mjs to a dynamic import() which is available in all CommonJS modules.

[feat]: `git-validator` pkg do not use `@zanminkian/prettier-config`

  • Double quote is better than single quote. Because in jsx file or html file, prettier format string used by label to double quote. For example, <div className="xxx"> instead of <div className='xxx'>. So using double quote will make code base consistent.
  • Using semi is better than not. In some edge case, user have to add semi, which is not consistent enough.
  • Print width 120 is too long maybe. I don't know how much is the best.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.