Git Product home page Git Product logo

base-3's Introduction

base

Base files we use to configure our repositories

Install

Install the appropriate editor plugins

VSCode

Customise your eslint configuration with the following from @balupton's configuration file

{
	"editor.detectIndentation": false,
	"editor.formatOnSave": true,
	"editor.insertSpaces": false,
	"editor.renderControlCharacters": true,
	"editor.renderIndentGuides": true,
	"eslint.alwaysShowStatus": true,
	"eslint.autoFixOnSave": true,
	"eslint.enable": true,
	"eslint.run": "onType",
	"files.trimTrailingWhitespace": true,
	"html.format.enable": true,
	"json.format.enable": true,
	"prettier.semi": false,
	"prettier.singleQuote": true,
	"prettier.useTabs": true,
	"typescript.format.enable": true,
	"typescript.suggest.completeFunctionCalls": true,
	"typescript.tsdk": "./node_modules/typescript/lib",
	"typescript.updateImportsOnFileMove.enabled": "always",
	"typescript.validate.enable": true,
	"markdownlint.config": {
		"MD007": {
			"indent": 4
		},
		"MD012": false,
		"MD022": false,
		"MD030": false,
		"MD032": false,
		"MD034": false
	},
	"eslint.validate": [
		"javascript",
		"javascriptreact",
		"typescript",
		"typescriptreact"
	],
	"eslint.options": {
		"ignorePattern": "**/*.d.ts"
	},
	"[json]": {
		"editor.defaultFormatter": "esbenp.prettier-vscode"
	},
}

GoLand

Download

Use HTTPie via the Terminal to download the appropraite base files:

# for all projects
http -d https://raw.githubusercontent.com/textileio/base/master/.editorconfig
http -d https://raw.githubusercontent.com/textileio/base/master/.gitignore

# for web projects (projects that are mostly html/javascript/typescript)
http -d https://raw.githubusercontent.com/textileio/base/master/.eslintignore
http -d https://raw.githubusercontent.com/textileio/base/master/.prettierignore

Setup

If convenient, make sure all PRs are merged beforehand to avoid merge conflicts.

On Go/Java Projects

On go projects we want to run prettier on everything, but ignore the errors.

npx prettier --write "./**" 2> /dev/null || true

On Web Projects

Uninstall the old dependencies:

rm tslint.json
npm uninstall tslint tslint-react

Install the dependencies:

# javascript/typescript/react projects
npm i -D prettier eslint eslint-config-bevry eslint-config-prettier eslint-plugin-prettier
    
# typescript projects
npm i -D @typescript-eslint/eslint-plugin @typescript-eslint/parser

# react projects
npm i -D eslint-plugin-react eslint-plugin-react-hooks @types/react

Add the eslint/prettier script to say package.json:scripts as build or lint or whatever.

eslint --fix --ext .mjs,.js,.jsx,.ts,.tsx .

Add the following to package.json which enables our rules:

{
  "eslintConfig": {
    "extends": [
      "bevry"
    ],
    "parserOptions": {
      "ecmaVersion": 6,
      "sourceType": "module",
      "ecmaFeatures": {
        "jsx": true
      }
    }
  },
  "prettier": {
    "semi": false,
    "singleQuote": true
  }
}

For typescript projects, you may wish to add the following to make the rules more compatible with typescript conventions:

{
  "eslintConfig": {
    "rules": {
      "no-undefined": 0,
      "default-case": 0
    }
  }
}

About

Refer to these discussion threads:

Inspired by bevry/base

base-3's People

Contributors

balupton avatar

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.