-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configured eslint-plugin-inclusive-language π (#3)
* Configured eslint-plugin-inclusive-language π * Compile the configuration files ποΈ * Updated depcheckrc π«€
- Loading branch information
Showing
8 changed files
with
124 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
ignores: [ | ||
"eslint-plugin-inclusive-language", | ||
"rimraf", | ||
"@types/jest" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import buildConfig from './eslint/build-config' | ||
|
||
export default buildConfig() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import InclusiveLanguageRules from './rules/inclusive-language' | ||
|
||
const buildConfig = () => ({ | ||
plugins: [ | ||
'inclusive-language', | ||
], | ||
rules: { | ||
...InclusiveLanguageRules, | ||
}, | ||
}) | ||
|
||
export default buildConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// https://github.com/muenzpraeger/eslint-plugin-inclusive-language | ||
|
||
export default { | ||
'inclusive-language/use-inclusive-words': [2, { | ||
lintStrings: true, | ||
}], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import fs from 'fs' | ||
import path from 'path' | ||
import util from 'util' | ||
|
||
const configFolder = './config' | ||
const outputFolder = './lib' | ||
|
||
/* | ||
* Utilities | ||
*/ | ||
|
||
const writeFile = async (filename: string, contents: Record<string, unknown>): Promise<void> => { | ||
const contentsString = util.inspect(contents, { | ||
depth: Infinity, | ||
maxArrayLength: Infinity, | ||
maxStringLength: Infinity, | ||
}) | ||
|
||
await fs.promises.writeFile(filename, `module.exports = ${contentsString}\n`) | ||
} | ||
|
||
/* | ||
* Compile Lint Configuration | ||
*/ | ||
|
||
const compileLintConfiguration = async (): Promise<void> => { | ||
try { | ||
const files = await fs.promises.readdir(configFolder) | ||
|
||
for (const file of files) { | ||
const filePath = path.join(configFolder, file) | ||
|
||
if ((await fs.promises.stat(filePath)).isFile()) { | ||
const filename = path.parse(file).name | ||
|
||
console.log(`Building config from "${file}"`) | ||
|
||
const module = await import(filePath) | ||
await writeFile(path.join(outputFolder, `${filename}.js`), module.default) | ||
|
||
console.log(`Successfully built "${filename}.js"!\n`) | ||
} | ||
} | ||
} catch (error) { | ||
console.error(`Error: ${error.message}`) | ||
} | ||
} | ||
|
||
/* | ||
* Copy Additional Files | ||
*/ | ||
|
||
const copyFiles = async () => { | ||
try { | ||
const files = [ | ||
'package.json', | ||
'README.md', | ||
] | ||
|
||
for (const file of files) { | ||
const sourcePath = path.resolve(`./${file}`) | ||
const destinationPath = path.join(outputFolder, file) | ||
|
||
await fs.promises.copyFile(sourcePath, destinationPath) | ||
console.log(`Successfully copied "${file}" to output folder`) | ||
} | ||
} catch (error) { | ||
console.error('An error occurred while copying files:', error) | ||
process.exit(1) | ||
} | ||
} | ||
|
||
/* | ||
* Run | ||
*/ | ||
|
||
const init = async () => { | ||
await compileLintConfiguration() | ||
await copyFiles() | ||
} | ||
|
||
init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2373,6 +2373,13 @@ escape-string-regexp@^4.0.0: | |
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" | ||
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== | ||
|
||
[email protected]: | ||
version "2.2.1" | ||
resolved "https://registry.yarnpkg.com/eslint-plugin-inclusive-language/-/eslint-plugin-inclusive-language-2.2.1.tgz#6cc0f70b10236e2709818f26140a2cbf2c82c041" | ||
integrity sha512-RL6avDWXCS0Dcp9axhvHRUp65qG07qjOrh6J4BNNahPvRY3PuYGnAd0H1strZ9cob79JiEW4Bq0j3gEuzbv0/A== | ||
dependencies: | ||
humps "^2.0.1" | ||
|
||
eslint-scope@^8.0.1: | ||
version "8.0.1" | ||
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-8.0.1.tgz#a9601e4b81a0b9171657c343fb13111688963cfc" | ||
|
@@ -2780,6 +2787,11 @@ human-signals@^2.1.0: | |
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" | ||
integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== | ||
|
||
humps@^2.0.1: | ||
version "2.0.1" | ||
resolved "https://registry.yarnpkg.com/humps/-/humps-2.0.1.tgz#dd02ea6081bd0568dc5d073184463957ba9ef9aa" | ||
integrity sha512-E0eIbrFWUhwfXJmsbdjRQFQPrl5pTEoKlz163j1mTqqUnU9PgR4AgB8AIITzuB3vLBdxZXyZ9TDIrwB2OASz4g== | ||
|
||
ignore@^5.2.0, ignore@^5.3.1: | ||
version "5.3.1" | ||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef" | ||
|