Skip to content

Commit

Permalink
fix: ESlint configuration for typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarzeev committed Mar 5, 2024
1 parent db51bde commit 9af8700
Show file tree
Hide file tree
Showing 12 changed files with 453 additions and 152 deletions.
17 changes: 14 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"env": {
"browser": true,
"commonjs": true
Expand All @@ -14,14 +15,24 @@
"ecmaVersion": 2020,
"sourceType": "module"
},
"overrides": [
{
"files": ["*.js", "*.jsx", "*.ts", "*.tsx"]
}
],
"globals": {
"describe": true,
"it": true,
"expect": true,
"jest": true
"jest": true,
"beforeAll": true,
"beforeEach": true,
"process": true
},
"plugins": ["@pedalboard/craftsmanlint"],
"plugins": ["@typescript-eslint", "@pedalboard/craftsmanlint"],
"rules": {
"@pedalboard/craftsmanlint/no-namespace-imports": ["error"]
"@pedalboard/craftsmanlint/no-namespace-imports": ["error"],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error"
}
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"@pedalboard/scripts": "^0.2.0",
"@swc/core": "^1.3.24",
"@swc/jest": "^0.2.24",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"lerna": "^5.0.0",
"nyc": "^15.1.0"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/components/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ module.exports = {
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
},
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!', '!**/node_modules/**'],
coveragePathIgnorePatterns: ['.cy.js', '.stories.tsx'],
};
3 changes: 2 additions & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@
"@storybook/test": "^7.6.12",
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.3",
"@types/react": "^18.2.61",
"babel-jest": "^27.5.1",
"babel-loader": "^8.2.3",
"chromatic": "10.6.1",
"cypress": "^10.1.0",
"esbuild": "^0.15.7",
"esbuild-sass-plugin": "^2.4.5",
"eslint": "^8.4.1",
"eslint": "8.57.0",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-storybook": "^0.6.15",
"identity-obj-proxy": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-craftsmanlint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"devDependencies": {
"@babel/core": "^7.16.5",
"@babel/preset-env": "^7.16.11",
"eslint": "^8.4.1",
"eslint": "8.57.0",
"jest": "^27.4.3",
"typescript": "^4.6.4"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/git-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@babel/core": "^7.16.5",
"@babel/preset-env": "^7.16.11",
"babel-jest": "^27.4.5",
"eslint": "^8.4.1",
"eslint": "8.57.0",
"jest": "^27.4.3",
"typescript": "^4.6.4"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable no-useless-escape */
import fs from 'fs';
import GitHook from '../GitHook';

Expand Down
4 changes: 2 additions & 2 deletions packages/hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"@babel/preset-env": "^7.16.11",
"@testing-library/react-hooks": "^7.0.2",
"babel-jest": "^27.4.5",
"eslint": "^8.4.1",
"eslint": "8.57.0",
"jest": "^27.4.3",
"typescript": "^4.6.4"
"typescript": "^5.3.3"
}
}
2 changes: 1 addition & 1 deletion packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"lint": "eslint ./src"
},
"devDependencies": {
"eslint": "^8.4.1",
"eslint": "8.57.0",
"jest": "^27.4.3"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/stylelint-plugin-craftsmanlint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@babel/core": "^7.16.5",
"@babel/preset-env": "^7.16.11",
"csstype": "^3.1.1",
"eslint": "8.57.0",
"jest": "^27.4.3",
"jest-preset-stylelint": "7.0.0",
"ts-node": "^10.9.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

import stylelint, {RuleMessage} from 'stylelint';
/* eslint-disable @pedalboard/craftsmanlint/no-namespace-imports */
import stylelint from 'stylelint';
import * as CSS from 'csstype';
import type * as PostCSS from 'postcss';

Expand All @@ -16,7 +17,6 @@ type Policy = {
};

type PrimaryOption = Record<keyof CSS.StandardPropertiesHyphen, Partial<Policy>>;
type SecondaryOption = Record<'severity', 'error' | 'warning'>;

const ruleName = 'stylelint-plugin-craftsmanlint/props-in-files';
const messages = stylelint.utils.ruleMessages(ruleName, {
Expand All @@ -31,7 +31,7 @@ const meta = {

const ALL_FILES_KEYWORD = 'all';

const ruleFunction = (primaryOption: PrimaryOption, secondaryOptionObject: SecondaryOption) => {
const ruleFunction = (primaryOption: PrimaryOption) => {
return (postcssRoot: PostCSS.Root, postcssResult: stylelint.PostcssResult) => {
const validOptions = stylelint.utils.validateOptions(postcssResult, ruleName, {
actual: null,
Expand Down
Loading

0 comments on commit 9af8700

Please sign in to comment.