Skip to content

Commit

Permalink
Refactor ESLint configuration to use TypeScript settings and streamli…
Browse files Browse the repository at this point in the history
…ne config files
  • Loading branch information
Kevin Koech authored and Kevin Koech committed Jan 9, 2025
1 parent 2cbaa81 commit b492483
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 125 deletions.
33 changes: 2 additions & 31 deletions apps/civicsignalblog/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
const eslintConfig = require("eslint-config-commons-ui/next");
const eslintConfig = require("eslint-config-commons-ui/typescript");

module.exports = [
{
settings: {
"import/resolver": {
webpack: {
config: "eslint.webpack.config.js",
},
typescript: {
alwaysTryTypes: false,
project: "./tsconfig.json",
},
},
},
},
...eslintConfig,
{
rules: {
"react/jsx-filename-extension": [1, { extensions: [".js", ".tsx"] }], // This rule allows JSX syntax in both .js and tsx files
// Disable requirement for importing file extensions for js and tsx files, without this we cant import custom components in Payload
"import/extensions": [
"error",
"ignorePackages",
{
js: "never",
tsx: "never",
},
],
},
},
];
module.exports = eslintConfig;
3 changes: 2 additions & 1 deletion apps/climatemappedafrica/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"@/commons-ui/payload/*": ["../../packages/commons-ui-payload/src/*"],
"@/hurumap/core/*": ["../../packages/hurumap-core/src/*"],
"@/hurumap/next/*": ["../../packages/hurumap-next/src/*"]
}
},
"target": "ES2017"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["build", "dist", "node_modules"]
Expand Down
33 changes: 2 additions & 31 deletions apps/roboshield/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
const eslintConfig = require("eslint-config-commons-ui/next");
const eslintConfig = require("eslint-config-commons-ui/typescript");

module.exports = [
{
settings: {
"import/resolver": {
webpack: {
config: "./eslint.webpack.config.js",
},
typescript: {
alwaysTryTypes: false,
project: "./tsconfig.json",
},
},
},
},
{
rules: {
"react/jsx-filename-extension": [1, { extensions: [".js", ".tsx"] }], // This rule allows JSX syntax in both .js and tsx files
// Disable requirement for importing file extensions for js and tsx files, without this we cant import custom components in Payload
"import/extensions": [
"error",
"ignorePackages",
{
js: "never",
tsx: "never",
},
],
},
},
...eslintConfig,
];
module.exports = eslintConfig;
33 changes: 2 additions & 31 deletions apps/techlabblog/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
const eslintConfig = require("eslint-config-commons-ui/next");
const eslintConfig = require("eslint-config-commons-ui/typescript");

module.exports = [
{
settings: {
"import/resolver": {
webpack: {
config: "./eslint.webpack.config.js",
},
typescript: {
alwaysTryTypes: false,
project: "./tsconfig.json",
},
},
},
},
...eslintConfig,
{
rules: {
"react/jsx-filename-extension": [1, { extensions: [".js", ".tsx"] }], // This rule allows JSX syntax in both .js and tsx files
// Disable requirement for importing file extensions for js and tsx files, without this we cant import custom components in Payload
"import/extensions": [
"error",
"ignorePackages",
{
js: "never",
tsx: "never",
},
],
},
},
];
module.exports = eslintConfig;
33 changes: 2 additions & 31 deletions apps/vpnmanager/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
const eslintConfig = require("eslint-config-commons-ui/next");
const eslintConfig = require("eslint-config-commons-ui/typescript");

module.exports = [
{
settings: {
"import/resolver": {
webpack: {
config: "./eslint.webpack.config.js",
},
typescript: {
alwaysTryTypes: false,
project: "./tsconfig.json",
},
},
},
},
...eslintConfig,
{
rules: {
"react/jsx-filename-extension": [1, { extensions: [".js", ".tsx"] }], // This rule allows JSX syntax in both .js and tsx files
// Disable requirement for importing file extensions for js and tsx files, without this we cant import custom components in Payload
"import/extensions": [
"error",
"ignorePackages",
{
js: "never",
tsx: "never",
},
],
},
},
];
module.exports = eslintConfig;
32 changes: 32 additions & 0 deletions packages/eslint-config-commons-ui/typescript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const nextConfig = require("./next");

module.exports = [
{
settings: {
"import/resolver": {
webpack: {
config: "./eslint.webpack.config.js",
},
typescript: {
alwaysTryTypes: false,
project: "./tsconfig.json",
},
},
},
},
...nextConfig,
{
rules: {
"react/jsx-filename-extension": [1, { extensions: [".js", ".tsx"] }], // This rule allows JSX syntax in both .js and tsx files
// Disable requirement for importing file extensions for js and tsx files, without this we cant import custom components in Payload
"import/extensions": [
"error",
"ignorePackages",
{
js: "never",
tsx: "never",
},
],
},
},
];

0 comments on commit b492483

Please sign in to comment.