Skip to content

Commit c8d7f0a

Browse files
feat(tools): remove eslint-plugin-prettier for prettier (freeCodeCamp#42438)
* feat: remove eslint-plugin-prettier for prettier This removes the annoying lint warnings when all that needs to change is formatting * fix: use .js lint-staged config to ignore properly * fix: lint everything if a lot of files are changed It's faster than making lots of individual linter calls * chore: apply prettier * fix: ignore code in curriculum-file-structure
1 parent 8518079 commit c8d7f0a

File tree

152 files changed

+919
-749
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+919
-749
lines changed

.eslintrc-base.json

-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
"operator-assignment": 0,
132132
"padded-blocks": 0,
133133
"prefer-object-spread/prefer-object-spread": 2,
134-
"prettier/prettier": "error",
135134
"quote-props": [2, "as-needed"],
136135
"quotes": [2, "single", "avoid-escape"],
137136
"radix": 2,

.eslintrc.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
"root": true,
1111
"extends": [
1212
"./.eslintrc-base.json",
13-
"plugin:prettier/recommended",
1413
"plugin:import/typescript",
15-
"plugin:jsx-a11y/recommended"
14+
"plugin:jsx-a11y/recommended",
15+
"prettier"
1616
],
1717
"plugins": [
1818
"react",
1919
"import",
2020
"prefer-object-spread",
21-
"prettier",
2221
"react-hooks",
2322
"jsx-a11y",
2423
"jest-dom",
@@ -58,7 +57,10 @@
5857
"plugins": ["@typescript-eslint"]
5958
},
6059
{
61-
"files": ["./tools/ui-components/**/*.test.[jt]s?(x)", "./client/**/*.test.[jt]s?(x)"],
60+
"files": [
61+
"./tools/ui-components/**/*.test.[jt]s?(x)",
62+
"./client/**/*.test.[jt]s?(x)"
63+
],
6264
"extends": ["plugin:testing-library/react", "plugin:jest-dom/recommended"]
6365
},
6466
{

.github/labeler.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
"scope: docs":
1+
'scope: docs':
22
- docs/**/*
33

4-
"scope: curriculum":
4+
'scope: curriculum':
55
- curriculum/challenges/**/*
66

7-
"platform: client":
7+
'platform: client':
88
- client/**/*
99

10-
"platform: api":
10+
'platform: api':
1111
- api-server/**/*
1212

13-
"scope: tools/scripts":
13+
'scope: tools/scripts':
1414
- cypress/**/*
1515
- tools/**/*
1616
- .github/**/*
1717
- utils/**/*
1818

19-
"scope: i18n":
19+
'scope: i18n':
2020
- any: ['curriculum/challenges/**/*', '!curriculum/challenges/english/**/*']
2121
- docs/i18n/**/*
2222
- client/i18n/**/*

.github/workflows/autoclose.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Autoclose
22
on:
33
pull_request_target:
44
branches:
5-
- "main"
5+
- 'main'
66
paths:
7-
- ".gitignore"
7+
- '.gitignore'
88

99
jobs:
1010
autoclose:

.github/workflows/codeql-analysis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "CodeQL"
1+
name: 'CodeQL'
22

33
on:
44
push:
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
language: ["javascript"]
17+
language: ['javascript']
1818
steps:
1919
- name: Checkout repository
2020
uses: actions/checkout@v2

.github/workflows/crowdin-i18n-client-ui-upload.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
workflow_dispatch:
44
schedule:
55
# runs everyday at 11:15 AM UTC
6-
- cron: "15 11 * * *"
6+
- cron: '15 11 * * *'
77

88
jobs:
99
i18n-upload-client-ui-files:

.github/workflows/crowdin-i18n-curriculum-download.yml

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ jobs:
5656
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_CURRICULUM }}
5757
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }}
5858

59-
6059
# Convert Simplified Chinese to Traditional #
6160
- name: Generate Translations
6261
uses: ./tools/crowdin/actions/convert-chinese

.github/workflows/crowdin-i18n-curriculum-upload.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
workflow_dispatch:
44
schedule:
55
# runs everyday at 11:30 AM UTC
6-
- cron: "30 11 * * *"
6+
- cron: '30 11 * * *'
77

88
jobs:
99
i18n-upload-curriculum-files:

.github/workflows/crowdin-i18n-docs-upload.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
workflow_dispatch:
44
schedule:
55
# runs everyday at 11:00 AM UTC
6-
- cron: "0 11 * * *"
6+
- cron: '0 11 * * *'
77

88
jobs:
99
i18n-upload-docs-files:

.github/workflows/cypress.yml

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ jobs:
5353
name: webpack-stats
5454
path: client/public/stats.json
5555

56-
5756
cypress-run:
5857
name: Test
5958
runs-on: ubuntu-18.04

.github/workflows/labeler.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: "Pull Request Labeler"
1+
name: 'Pull Request Labeler'
22
on:
3-
- pull_request_target
3+
- pull_request_target
44

55
jobs:
66
triage:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/labeler@v3
10-
with:
11-
repo-token: "${{ secrets.GITHUB_TOKEN }}"
12-
sync-labels: true
9+
- uses: actions/labeler@v3
10+
with:
11+
repo-token: '${{ secrets.GITHUB_TOKEN }}'
12+
sync-labels: true

.lintstagedrc.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const { ESLint } = require('eslint');
2+
3+
const cli = new ESLint();
4+
5+
// if a lot of files are changed, it's faster to run prettier/eslint on the
6+
// whole project than to run them on each file separately
7+
module.exports = {
8+
'*.(js|ts|tsx)': files =>
9+
files.length > 10
10+
? ['eslint --max-warnings=0 --cache --fix .', 'prettier --write .']
11+
: [
12+
'eslint --max-warnings=0 --cache --fix ' +
13+
files.filter(file => !cli.isPathIgnored(file)).join(' '),
14+
...files.map(filename => `prettier --write '${filename}'`)
15+
],
16+
'*.!(js|ts|tsx)': files =>
17+
files.length > 10
18+
? 'prettier --write .'
19+
: files.map(
20+
filename => `prettier --write --ignore-unknown '${filename}'`
21+
),
22+
'./curriculum/challenges/**/*.md': files =>
23+
files.length > 10
24+
? 'npm run lint:challenges'
25+
: files.map(
26+
filename => `node ./tools/scripts/lint/index.js '${filename}'`
27+
)
28+
};

.prettierignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
**/.cache
22
**/public
33
client/static
4-
fixtures
4+
**/*fixtures*
55
curriculum/challenges/_meta/*/*
66
curriculum/challenges/**/*
7+
config/**/*.json
8+
client/i18n/**/*.json
9+
docs/i18n

CODE_OF_CONDUCT.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
21
> Our Code of Conduct is available here: <https://www.freecodecamp.org/code-of-conduct/>

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
## Our contributing docs are available here: <https://contribute.freecodecamp.org>.
22

3-
Looking to edit these docs? Read [this document](https://contribute.freecodecamp.org/#/how-to-work-on-the-docs-theme) first.
3+
Looking to edit these docs? Read [this document](https://contribute.freecodecamp.org/#/how-to-work-on-the-docs-theme) first.

HoF.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ We appreciate any responsible disclosure of vulnerabilities that might impact th
44

55
- Mehul Mohan from [codedamn](https://codedamn.com) ([@mehulmpt](https://twitter.com/mehulmpt)) - [Vulnerability Fix](https://github.com/freeCodeCamp/freeCodeCamp/blob/bb5a9e815313f1f7c91338e171bfe5acb8f3e346/client/src/components/Flash/index.js)
66
- Peter Samir https://www.linkedin.com/in/peter-samir/
7-
> ### Thank you for your contributions :pray:
7+
> ### Thank you for your contributions :pray:

LICENSE.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ All rights reserved.
66
Redistribution and use in source and binary forms, with or without
77
modification, are permitted provided that the following conditions are met:
88

9-
* Redistributions of source code must retain the above copyright notice, this
9+
- Redistributions of source code must retain the above copyright notice, this
1010
list of conditions and the following disclaimer.
1111

12-
* Redistributions in binary form must reproduce the above copyright notice,
12+
- Redistributions in binary form must reproduce the above copyright notice,
1313
this list of conditions and the following disclaimer in the documentation
1414
and/or other materials provided with the distribution.
1515

16-
* Neither the name of the copyright holder nor the names of its
16+
- Neither the name of the copyright holder nor the names of its
1717
contributors may be used to endorse or promote products derived from
1818
this software without specific prior written permission.
1919

api-server/.babelrc

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
"presets": [
33
[
44
"@babel/preset-env",
5-
{"targets": {
6-
"node": 10
7-
}}
5+
{
6+
"targets": {
7+
"node": 10
8+
}
9+
}
810
]
911
],
1012
"plugins": [

api-server/src/common/index.less

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
&{ @import "./app/index.less"; }
1+
& {
2+
@import './app/index.less';
3+
}

api-server/src/common/models/user.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,7 @@
276276
"default": {}
277277
},
278278
"donationEmails": {
279-
"type": [
280-
"string"
281-
]
279+
"type": ["string"]
282280
},
283281
"isDonating": {
284282
"type": "boolean",

client/package.json

-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525
"clean": "gatsby clean",
2626
"predevelop": "node ../tools/scripts/build/ensure-env.js && npm run build:workers -- --env development",
2727
"develop": "node --max_old_space_size=4000 node_modules/gatsby-cli develop --inspect=9230",
28-
"format": "npm run format:gatsby && npm run format:src && npm run format:utils",
29-
"format:gatsby": "prettier-eslint --write --trailing-comma none --single-quote './gatsby-*.js'",
30-
"format:src": "prettier-eslint --write --trailing-comma none --single-quote './src/**/*.js'",
31-
"format:utils": "prettier-eslint --write --trailing-comma none --single-quote './utils/**/*.js'",
3228
"lint": "node ./i18n/schema-validation.js",
3329
"serve": "gatsby serve -p 8000",
3430
"serve-ci": "serve -l 8000 -c ../serve.json public",

client/src/pages/learn/back-end-development-and-apis/back-end-development-and-apis-projects/index.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ title: Introduction to the Back End Development and APIs Projects
33
block: Back End Development and APIs Projects
44
superBlock: Back End Development and APIs
55
---
6+
67
## Introduction to the Back End Development and APIs Projects
78

89
Time to put your newly learnt skills to work! By working on projects you would have the opportunity of applying all the skills, principles and concepts you have learnt so far including npm packages, basic Node, basic Express, MongoDB, and Mongoose.
910

1011
In this section you get the chance to:
11-
* Build a Timestamp Microservice
12-
* Build a Request Header Parser Microservice
13-
* Build a URL Shortener Microservice
14-
* Build a Exercise Tracker
15-
* Build a File Metadata Microservice
12+
13+
- Build a Timestamp Microservice
14+
- Build a Request Header Parser Microservice
15+
- Build a URL Shortener Microservice
16+
- Build a Exercise Tracker
17+
- Build a File Metadata Microservice
1618

1719
By the end of this, you would have 5 microservices under your belt that you can show off to friends, family, employers, etc. Have fun and remember to use the [Read-Search-Ask](https://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck-coding/19514) method if you get stuck.

client/src/pages/learn/back-end-development-and-apis/index.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Back End Development and APIs
33
superBlock: back-end-development-and-apis
44
---
5+
56
## Introduction to Back End Development and APIs
67

78
This is a stub introduction for Back End Development and APIs
@@ -19,7 +20,8 @@ A monolith typically has the three key components of any application - the UI, B
1920
To overcome some of the issues, one of the suggestions that was made early on was to functionally decompose an application, referred to as the Scale Cube in the book [The Art of Scalability](www.theartofscalability.com). This eventually led to the microservices pattern that we see now. A microservice takes a single bit of functionality and bundles all the layers of technology into it. This means that each microservice has its own UI, business logic and data store. To deliver a larger piece of functionality, microservices talk to one another through common communication methods like APIs or messages.
2021

2122
## Key benefits
22-
1. Microservices can be developed and deployed independently of one another, thereby reducing the risk of one wrong piece of code bringing down an entire application
23+
24+
1. Microservices can be developed and deployed independently of one another, thereby reducing the risk of one wrong piece of code bringing down an entire application
2325
2. Easier to isolate and find where issues lie, while debugging
2426
3. Fits the modern DevOps paradigm, as the architecture is well placed for Continuous Integration/Continuous Deployment
2527
4. Enables developers to choose a language and data store technology best suited for that bit of functionality
@@ -28,13 +30,15 @@ To overcome some of the issues, one of the suggestions that was made early on wa
2830
7. Easy to change, as it encapsulates a single piece of business functionality
2931

3032
## Key drawbacks
33+
3134
1. Additional operational overheads to monitor and manage multiple services
3235
2. Manage communications between services
3336
3. Additional effort to build fault tolerance
3437
4. Getting the right balance of functional and data separation is not easy
3538
5. Distributed transaction model comes with its own share of issues regarding data consistency (eventual consistency)
3639

3740
### Sources
41+
3842
1. Microservices, a definition - by Martin Fowler and James Lewis : https://www.martinfowler.com/articles/microservices.html
3943
2. Introduction to Microservices - NGINX blog : https://www.nginx.com/blog/introduction-to-microservices/
4044
3. What are microservices - Smartbear : https://smartbear.com/learn/api-design/what-are-microservices/

client/src/pages/learn/coding-interview-prep/algorithms/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Introduction to the Coding Interview Algorithms
33
block: Algorithms
44
superBlock: Coding Interview Prep
55
---
6+
67
## Introduction to the Coding Interview Prep Algorithms
78

89
These challenges are meant to teach and challenge you with common algorithms that you will encounter in real life. These challenges will be a great learning experience to help improve your programming and logical skills.

client/src/pages/learn/coding-interview-prep/data-structures/index.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Introduction to the Coding Interview Data Structure Questions
33
block: Data Structures
44
superBlock: Coding Interview Prep
55
---
6+
67
## Introduction to the Coding Interview Data Structure Questions
78

8-
These excercises are meant to help you deal with large or complex data by using many different data types other than your standard objects or arrays.
9+
These excercises are meant to help you deal with large or complex data by using many different data types other than your standard objects or arrays.

client/src/pages/learn/coding-interview-prep/project-euler/index.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ title: Introduction to the Project Euler Problems
33
block: Project Euler
44
superBlock: Coding Interview Prep
55
---
6+
67
## Introduction to the Project Euler Problems
78

89
[Project Euler](https://projecteuler.net/) (pronounced Oiler) is a series of challenging mathematical/computer programming problems meant to delve into unfamiliar areas and learn new concepts in a fun and recreational manner.
910

10-
>The problems range in difficulty and for many the experience is inductive chain learning. That is, by solving one problem it will expose you to a new concept that allows you to undertake a previously inaccessible problem.
11+
> The problems range in difficulty and for many the experience is inductive chain learning. That is, by solving one problem it will expose you to a new concept that allows you to undertake a previously inaccessible problem.
1112
>
1213
> Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.
1314
>
14-
>_from the Project Euler <a href='https://projecteuler.net/' rel='noopener noreferrer'>home page</a>_
15+
> _from the Project Euler <a href='https://projecteuler.net/' rel='noopener noreferrer'>home page</a>_

client/src/pages/learn/coding-interview-prep/rosetta-code/index.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ title: Introduction to the Rosetta Code Problems
33
block: Rosetta Code
44
superBlock: Coding Interview Prep
55
---
6+
67
## Introduction to the Rosetta Code Problems
78

89
[The Rosetta Code](https://rosettacode.org) is a list of programming challenges which will help you build your programming skills.
9-
>"The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one approach to a problem in learning another." - _Homepage of the Rosetta Code site_
10+
11+
> "The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one approach to a problem in learning another." - _Homepage of the Rosetta Code site_

client/src/pages/learn/coding-interview-prep/take-home-projects/index.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ title: Introduction to the Coding Interview Take Home Projects
33
block: Take Home Projects
44
superBlock: Coding Interview Prep
55
---
6+
67
## Introduction to the Coding Interview Take Home Projects
78

89
Programming interviews have always been stressful. One of the solutions is giving the applicant a take home project to be completed outside of the interview. These types of interviews usually require a lot of work, but they're a great way for employers to see how you might perform on the job.
910

1011
The interview after the project submission could be a discussion about the applicant’s design decisions, scalability, and what the applicant might have done differently. This approach is more effective when the applicant doesn’t have a lot of publicly available past projects.
1112

1213
In this section you get the chance to work on many Take Home Projects like:
13-
* Show Local Weather using Weather API and Geolocation
14-
* Build a Wikipedia Viewer using Wikipedia's API
15-
* Build a Pinterest Clone using Masonry.js library
16-
and many more!
14+
15+
- Show Local Weather using Weather API and Geolocation
16+
- Build a Wikipedia Viewer using Wikipedia's API
17+
- Build a Pinterest Clone using Masonry.js library
18+
and many more!
1719

1820
By the end of this section, you will have plenty of Take Home Projects under your belt. This will boost your confidence and prepare you for Take Home Project Interviews. Have fun and remember to use the [Read-Search-Ask](https://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck/19514) method if you get stuck.

0 commit comments

Comments
 (0)