Skip to content

Commit

Permalink
feat: disable prettier conflicts, change lint-staged to just lint-all (
Browse files Browse the repository at this point in the history
…#119)

* try fix

Signed-off-by: Regina Wang <rrreggginnna@gmail.com>

* remove lint-staged

Signed-off-by: Regina Wang <rrreggginnna@gmail.com>

* remove prettier

Signed-off-by: Regina Wang <rrreggginnna@gmail.com>

* turn off all conflicts with prettier and bring it back

* yarn lock changes

Signed-off-by: Regina Wang <rrreggginnna@gmail.com>

* test linting

Signed-off-by: Regina Wang <rrreggginnna@gmail.com>

* test linting

Signed-off-by: Regina Wang <rrreggginnna@gmail.com>

* remove lint error

Signed-off-by: Regina Wang <rrreggginnna@gmail.com>

* lint changes
  • Loading branch information
reginawang3495 authored Jan 25, 2022
1 parent a5537c6 commit 75c60e4
Show file tree
Hide file tree
Showing 14 changed files with 805 additions and 1,359 deletions.
14 changes: 7 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ module.exports = {
'plugin:react/recommended',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',

// override all prettier rules, see https://github.com/prettier/eslint-config-prettier
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
Expand Down Expand Up @@ -40,9 +43,6 @@ module.exports = {
// Style
quotes: ['error', 'single', { avoidEscape: true }],

// ensures clean diffs, see https://medium.com/@nikgraf/why-you-should-enforce-dangling-commas-for-multiline-statements-d034c98e36f8
'comma-dangle': ['error', 'always-multiline'],

// Require all imported dependencies are actually declared in package.json
'import/no-extraneous-dependencies': [
'error',
Expand All @@ -69,8 +69,8 @@ module.exports = {

// Cannot shadow names
// note you must disable the base rule as it can report incorrect errors
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],

// Required spacing in property declarations (copied from TSLint, defaults are good)
'key-spacing': ['error'],
Expand Down Expand Up @@ -100,8 +100,8 @@ module.exports = {
'@typescript-eslint/no-floating-promises': ['error'],

// Don't leave log statements littering the premises!
'no-console': ["error", { allow: ["info", "warn", "error"] }],
'no-console': ['error', { allow: ['info', 'warn', 'error'] }],

// Useless diff results
'no-trailing-spaces': ['error'],

Expand Down
12 changes: 6 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: monthly
time: "13:00"
open-pull-requests-limit: 10
- package-ecosystem: npm
directory: '/'
schedule:
interval: monthly
time: '13:00'
open-pull-requests-limit: 10
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on: [push]

jobs:
build:

runs-on: ubuntu-latest

strategy:
Expand All @@ -14,7 +13,7 @@ jobs:
steps:
- name: Checkout Git repo
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"singleQuote": true
"singleQuote": true,
"trailingComma": "es5"
}
6 changes: 5 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"extends": ["stylelint-config-recommended", "stylelint-config-sass-guidelines"],
"extends": [
"stylelint-config-recommended",
"stylelint-config-sass-guidelines",
"stylelint-config-prettier"
],
"rules": {
"color-named": null,
"selector-max-id": null,
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ The instructions to install Node.js will be different based on which platform yo

### macOS or Linux

Instructions for installing NVM on macOS and Linux (including WSL) are [here](https://github.com/nvm-sh/nvm#installing-and-updating).
Instructions for installing NVM on macOS and Linux (including WSL) are [here](https://github.com/nvm-sh/nvm#installing-and-updating).

At this point you can run `nvm install`. Assuming you've already `cd`ed into the correct directory as mentioned earlier, this will download the LTS (Long-Term Support) version of Node.js for you. Then, run `nvm use` to make sure you've switched to the right version; if it tells you `Now using Node v16` or something similar, you're good to go!
At this point you can run `nvm install`. Assuming you've already `cd`ed into the correct directory as mentioned earlier, this will download the LTS (Long-Term Support) version of Node.js for you. Then, run `nvm use` to make sure you've switched to the right version; if it tells you `Now using Node v16` or something similar, you're good to go!

### Windows

Expand Down
18 changes: 7 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
"scripts": {
"start": "webpack serve --open --config webpack.dev.js",
"build": "webpack --config webpack.prod.js",
"lint-staged": "lint-staged",
"lint": "eslint \"**/*.tsx\" \"**/*.ts\" && npx stylelint \"**/*.css\" \"**/*.scss\"",
"lint-fix": "eslint --fix \"**/*.tsx\" \"**/*.ts\" && npx stylelint --fix \"**/*.css\" \"**/*.scss\"",
"pre-commit": "lint-staged; exit 0",
"lint": "eslint \"**/*.tsx\" \"**/*.ts\" && npx stylelint \"**/*.css\" \"**/*.scss\" && prettier --check .",
"lint-fix": "eslint --fix \"**/*.tsx\" \"**/*.ts\" && npx stylelint --fix \"**/*.css\" \"**/*.scss\" && prettier --write .",
"pre-commit": "yarn lint-fix || true",
"prepare": "husky install"
},
"dependencies": {
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.10",
"babelify": "^10.0.0",
"browserify": "^17.0.0",
"eslint-plugin-prettier": "^4.0.0",
"prettier": "^2.5.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react-dom": "^17.0.2",
"stylelint-config-prettier": "^9.0.3"
},
"devDependencies": {
"@babel/core": "^7.14.8",
Expand All @@ -33,14 +34,14 @@
"core-js": "^3.20.2",
"css-loader": "^6.5.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.0.8",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.5.0",
"husky": "^7.0.4",
"lint-staged": "^12.2.2",
"mini-css-extract-plugin": "^2.4.5",
"sass": "^1.44.0",
"sass-loader": "^12.4.0",
Expand All @@ -58,10 +59,5 @@
"webpack-merge": "^5.8.0",
"webpack-nano": "^1.1.1",
"webpack-pwa-manifest": "^4.3.0"
},
"lint-staged": {
"*.(ts|tsx)": "eslint --cache --fix",
"*.(css|scss|sass)": "stylelint --fix",
"*.{ts,tsx,css,scss,sass,md}": "prettier --write"
}
}
3 changes: 1 addition & 2 deletions src/components/shared/AppWrapper/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ function Footer(): JSX.Element {
return (
<div id="footer">
<h3>
made with ❤️ by
{' '}
made with ❤️ by{' '}
<a
href="https://teachla.uclaacm.com"
target="_blank"
Expand Down
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ ReactDOM.render(
<StrictMode>
<App />
</StrictMode>,
document.getElementById('root'),
document.getElementById('root')
);
2 changes: 1 addition & 1 deletion src/styles/AppWrapper.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $header-height: 8vh;
background-color: white;
bottom: 0;
display: flex;
font-family: 'Westwood Sans','Helvetica Neue', 'Helvetica', sans-serif;
font-family: 'Westwood Sans', 'Helvetica Neue', 'Helvetica', sans-serif;
height: $header-height;
justify-content: center;
position: fixed;
Expand Down
2 changes: 1 addition & 1 deletion src/styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

@font-face {
font-family: 'Westwood Sans';
src: local('Westwood Sans'),
src: local('Westwood Sans'),
url('../assets/WestwoodSans-Regular.ttf') format('truetype');
}

Expand Down
5 changes: 1 addition & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
"resolveJsonModule": true,
"composite": true,
"incremental": true,
"typeRoots": [
"./node_modules/@types",
"./custom_typing"
]
"typeRoots": ["./node_modules/@types", "./custom_typing"]
},
"include": ["**/*.ts", "**/*.tsx"]
}
6 changes: 1 addition & 5 deletions webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ module.exports = merge(common, {
rules: [
{
test: /\.(sa|sc|c)ss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader',
],
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
},
{
test: /\.(png|svg|jpe?g|gif|mp3|ttf)$/i,
Expand Down
Loading

0 comments on commit 75c60e4

Please sign in to comment.